Retired Navy Adm. Charles R. Larson, whose impeccable credentials led to a high-profile stint in the 1990s leading the U.S. Naval Academy in the aftermath of the worst cheating scandal in the military college’s history, died July 26 at his home in Annapolis. He was 77.

The cause was pneumonia, said a son-in-law, Navy Cmdr. Wesley Huey, adding that the four-star admiral was diagnosed with leukemia two years ago.

A strong contender to succeed Colin Powell as chairman of the joint chiefs of staff in 1993, Adm. Larson was instead passed over, and he seemed on the verge of retirement when he was asked to lead the Naval Academy.

He seemed an ideal choice, with his ramrod bearing and a career spent climbing the military ladder with distinction. A White House Fellow under Lyndon B. Johnson, he later served as a naval aide to President Richard M. Nixon and commanded a nuclear attack submarine on an espionage mission against the Soviets. In 1991, he was named commander in chief of the U.S. Pacific Command in Hawaii, overseeing 350,000 military personnel spanning more than 40 countries.

Adm. Larson was Naval Academy superintendent from 1983 to 1986. When he again took over the Naval Academy in 1994, he was the first four-star admiral to serve as superintendent — the highest-ranking officer ever to oversee the 4,100-student academy. He was also a graduate, a member of the Class of 1958 that included future Vietnam War hero, U.S. senator and Republican presidential nominee John McCain.

Adm. Charles R. Larson (Craig Herndon/The Washington Post)

The campus in Annapolis was still reeling from a December 1992 scandal that ensnared more than 130 midshipmen for cheating on an electrical engineering exam. Twenty-four midshipmen were ordered expelled, and more than 60 were reportedly found guilty of honor violations that resulted in lesser punishments. A Navy investigation exonerated nearly 40 midshipmen. About 10 did not return to Annapolis for unrelated reasons.

With a mandate to clean up the institution, Adm. Larson started a new ethics and character-development curriculum and made efforts to restore discipline. He tightened rules about when midshipmen could leave campus and wear civilian clothing and made other changes intended to give enforcement of the honor code more teeth.

Outbreaks of criminal behavior continued to roil the campus. It became national news when midshipmen were arrested for drug use, involvement in a car-theft ring and sexual assault.

Adm. Larson told the New York Times in 1996 that the incidents were isolated and did not reflect chronic problems with the academy’s integrity.

“We had the same number of incidents when I was here before, just never three in one week,” he said, referring to his earlier tenure as superintendent. “They were just as serious incidents then, but they happened one at a time.”

The fallout continued in 1996 after a civilian professor at the academy, James F. Barry, published in The Washington Post an opinion piece saying the school “is plagued by a serious morale problem caused by a culture of hypocrisy, one that tolerates sexual harassment, favoritism and the covering up of problems.”

Naval Academy authorities removed Barry from teaching duties — seemingly a punishment for speaking out. Amid protests by the American Association of University Professors, he returned to classroom work but soon left the academy.

A review panel in 1997, co-chaired by retired Navy admiral and former CIA director Stansfield Turner, concluded that academy leaders were too defensive in their response to crises but the incidents were “not indicative of a systemic flaw.”

“The most important thing he did for the Naval Academy,” McCain once said of Adm. Larson, “was to bring it back from a deep malaise.”

After his naval retirement in 1998, Adm. Larson chaired a Maryland task force on higher education and served as vice chairman of the University System of Maryland’s Board of Regents.

In 2002, Maryland Lt. Gov. Kathleen Kennedy Townsend (D), a daughter of Sen. Robert F. Kennedy and niece of President John F. Kennedy, surprised the state’s political establishment by tapping Adm. Larson as her gubernatorial running mate.

Washingtonian magazine reported that her first choice, Freeman A. Hrabowski III, an African American and president of the University of Maryland, Baltimore County, turned her down, forcing the campaign to shift from an “education track” to the “post-9/11 security track.”

“This could prove to be an act of genius if al Qaeda gunboats show up on the Patapsco River before Election Day,” the magazine quipped.

The admiral, who was as surprised as anyone by Townsend’s decision to offer him the spot on her ticket, changed his political affiliation to Democrat and explained to reporters that he was dismayed by the hard-right tilt of the Republican Party on social issues.

He was, by all accounts, a nimble campaigner. But the team lost to then-U.S. Rep. Robert L. Ehrlich Jr. (R) and Michael S. Steele, an African American lawyer who had been chairman of the state’s Republican Party.

In a state that had not had a Republican governor since Spiro Agnew in the late 1960s, the Democratic defeat was largely blamed on Townsend. Despite the Kennedy political name, she had little of the Kennedy polish on the hustings. She had a tendency to mangle words, once calling her running mate “Ambassador Lawson.”

Charles Robert Larson was born Nov. 20, 1936, in Sioux Falls, S.D., and raised in Omaha, where his father was a telephone company employee and his mother was a teacher.

He initially trained as a naval aviator, flying off aircraft carriers, but soon switched to the nuclear submarine service, sensing accurately that they would play an ever-greater tactical and strategic role for the Navy during the Cold War.

From 1973 to 1976, he was skipper of the nuclear attack submarine Halibut, which conducted underwater espionage missions against the Soviet Union, including tapping into a Russian undersea communications cable in the western Pacific.

His military decorations included the Defense Distinguished Service Medal, seven awards of the Navy Distinguished Service Medal, three awards of the Legion of Merit and the Bronze Star Medal. In retirement, he was board chairman of the U.S. Naval Academy Foundation, which helps raise private money for the institution.

Survivors include his wife of 52 years, Sarah “Sally” Craig Larson of Annapolis; three daughters, Sigrid Larson of Philadelphia, Erica Larson of Annapolis and Kirsten Datko of Arnold, Md.; a sister; and seven grandchildren.

In 1997, Adm. Larson invited McCain to lecture the entire Naval Academy on the importance of virtue in American life. Someone in the audience asked McCain — who earned the nickname “McNasty” as a young man because of his rebellious, often reckless personal behavior — if he could reveal any “dirt” about Adm. Larson as a midshipman.

According to an account in the Baltimore Sun, McCain recalled the time when he threw a party for 300 friends at his parents’ home in Washington. The place was “completely destroyed,” he said. A prized family piano was among the casualties, Adm. Larson having left a cigarette on the instrument.

McCain said his mother viewed the future admiral as an otherwise stabling influence on her son. “If it was me, my mom would have killed me,” the senator added. “But with Charles, my mother said, ‘Oh, it was Chuck? That’s okay.’ ”