WASHINGTON -- Secretary of the Army Ryan McCarthy told West Point cadets Friday that resilience will be key to their success in life and that bouncing back will take courage, effort and a positive attitude.

"We don't demand perfect leaders, but we do expect perfect effort," he said.

"Attitude, courage and effort are the only things in our control, but they are also the things that make us successful in life," he told academy seniors, known as first-class cadets or "firsties."

McCarthy spoke to the cadets just three weeks after a third-year cadet turned up missing, sparking a massive search of the 6,000-acre campus along the Hudson River in New York. The cadet was eventually found dead in the basement of a building with his M4 carbine.

"If you are hurting, we are here," McCarthy told the cadets, adding if they have ideas to help combat the nation's suicide epidemic that "we are listening."

"We are all vulnerable to feelings of shame and grief. No institution -- not even this one -- can be inoculated against the threat of suicide," he said.

"We all struggle. Failure is a part of the human endeavor."

Failure provides feedback important for future success, McCarthy said.

"How quickly you can metabolize feedback is the rate at which you can cultivate resilience, and resilience is how quickly you can get back up."

McCarthy told the cadets about troubles he had as a second-year cadet at the Virginia Military Institute.

"Suffice it to say, I walked a great many tours alone, and in the darkness of a courtyard. I scrubbed an endless sea of toilets, and shined a metric ton of shoes. I stumbled and I faced consequences."

After two years at the school, he was sent home to Chicago where he lived with his parents and worked for a while in a warehouse.

"My catastrophic failure in college forged my grit, which would ultimately be tested in the crucible of combat," McCarthy said.

McCarthy eventually went back and graduated with a new resolve, and he went on to earn a master's degree in business administration from the University of Maryland.

Between 1997 and 2002, he served on active duty and deployed to Afghanistan with the 75th Ranger Regiment.

In 2005, his college roommate and friend, Capt. James Edge, was killed in Ramadi, Iraq.

He described his friend as a 6-foot-2, athletic "poster" Marine.

"I was there when he proposed to his wife, and I was there when they laid him to rest in Arlington National Cemetery," McCarthy said.

"Grief, like failure, is a powerful emotion," he told the cadets. "It can break you down, or feed your resolve."

He said his friend's death motivated him to re-enter government in order to make a difference.

"I renewed my commitment to the nation. And each day I strive to honor James by choosing attitude and courage much like his," McCarthy said.

"There are painful situations that you will encounter in life. They can either drive you, or they can define you," he concluded.

McCarthy also spoke to other cadets from the balcony in Washington Hall as they were dining. In addition, he attended an office call with the academy's superintendent, Lt. Gen. Darryl Williams. He was accompanied on the office call by Terry Bradshaw and Howie Long of Fox Sports.

On Sunday, McCarthy took part in a Fox NFL broadcast from West Point.

On Saturday, he attended a West Point football game, volleyball match, and rugby game. In football, West Point beat the University of Massachusetts, 63-7, ending a five-game losing streak for the Black Knights. Following the win, Army coach Jeff Monken said he was proud of his team for staying resilient.