Sen. Lindsey O. Graham (R-S.C.) leaves his military retirement ceremony June 24 at the National Guard Memorial Museum in Washington. (Matt McClain/The Washington Post)

Of all the candidates vying to become the nation’s next commander in chief, none has spent as much time in the military as Sen. Lindsey O. Graham. The South Carolina Republican retired from the Air Force this summer after a 33-year career, including two decades as a reservist while serving in Congress.

Graham is running as a ­national-security hawk, calling himself a “battle-tested leader” with “a lifetime of military service.” Images of him wearing camouflage in the field are a common thread in his campaign.

But a detailed examination of Graham’s military record — much of it obtained under the Freedom of Information Act — shows that the Air Force afforded him special treatment as a lawmaker, granting him the privileges of rank with few expectations in return.

During his first decade in Congress, the Air Force promoted Graham twice even though documents in his military personnel file reveal that he did little or no work. Later, the Pentagon gave the military lawyer a job assignment in the Air Force Reserve that he highlighted in his biography for several years but never performed.

After he was first elected to the House of Representatives in 1994, Graham was designated by the Air Force Reserve as a “key federal employee,” a category for a small number of lawmakers and senior government officials.

Over the next 10 years, he rarely put on his uniform. According to his personnel file, between January 1995 and January 2005 he received credit for a total of 108 hours of training — the equivalent of less than a day and a half per year.

During that span, however, the Air Force kept awarding him promotions. In 1998, he attained the rank of lieutenant colonel in the Judge Advocate General’s Corps. Six years later, he was promoted to colonel by President George W. Bush.

In interviews with The Washington Post, Graham called that period the “wilderness years” of his military service. He said he struggled to find a useful niche in the Reserve and that his legislative duties left him little time to devote to his military career.

“At one time I almost thought about getting out because I felt like, okay, what am I doing here?” he said.

He added, “I didn’t feel guilty because I wasn’t getting any money.” As a key federal employee, he could earn points for a military pension but was ineligible for a service paycheck.

Even so, Graham said his promotions to lieutenant colonel and colonel were warranted. He said he earned them primarily based on his work as a junior officer, before he became a politician, when he served as a full-time military prosecutor and defense counsel.

“I think when it came to being Colonel Graham that they looked at my entire record, and I’ll put it up against anybody who’s ever served,” he said. “I don’t mean to pat myself on the back, but I was one hell of a judge advocate.

Sen. Lindsey O. Graham (R-S.C.), second from right, with pistol strapped around his leg, walks with Sen. Bob Corker (R-Tenn.) during a visit to Parwan, Afghanistan on July 7, 2013. Graham was a colonel in the Air Force Reserve. (Staff Sgt. Tramel Garrett/U.S. Army)

“Yeah, I think I deserved promotion.”

The arrangement benefited both sides. Graham emphasized his ongoing military service in his political campaigns, while the Air Force was grateful to have an influential lawmaker in its ranks.

“They wanted to hang onto me and I didn’t want to leave,” Graham said.

The Air Force referred questions to the Air Reserve Personnel Center. Col. Robert Palmer, a spokesman for the center, said that “selection for promotion is based on the whole person concept, which includes performance, professional qualities, leadership, depth and breadth of experience, specific achievements, academic education, and developmental education.”

Jack L. Rives, a retired Air Force judge advocate general who oversaw Graham’s assignments for several years, said he was an accomplished lawyer who took his Reserve duties seriously.

Asked if Graham’s standing in Congress influenced the Air Force’s decision to promote him to colonel, Rives replied: “Your question is a good one and a natural one. But I can say from having served on [promotion] boards, you do score the record and you take an oath to do that. People are warned specifically you can’t show favoritism.”

A no-show assignment

After he became a colonel, Graham began to dedicate more hours to the Reserve. He deployed for brief stints in Iraq and Afghanistan, visits timed to overlap with his travels there as a senator.

For nearly a decade, however, Graham gave inaccurate public descriptions of his job assignment, records show.

From 2006 until the start of this year, Graham’s official biographies stated that he worked as a senior instructor at the Judge Advocate General’s School at Maxwell Air Force Base in Montgomery, Ala., the training hub for the service’s legal corps. That description has been cited in virtually all news coverage of Graham’s military career.

In fact, Air Force officials said they had no record of Graham teaching any courses on behalf of the school or even visiting it during that period.

Other uniformed lawyers said Graham’s assignment was widely perceived as a no-show job granted to a politician with whom the Air Force brass was eager to curry favor.

“It was kind of an open joke among people, that he was supposed to be a senior instructor here but he never taught any classes,” said an active-duty Air Force lawyer who spoke on the condition of anonymity out of fear of retaliation. “Clearly, the rules didn’t apply to him.”

In his interviews with The Post, Graham acknowledged that he “never went” to Maxwell Air Force Base and didn’t serve as an instructor for the school. “I actually did zero,” he said with a chuckle. “I don’t know why they picked that title.”

He clarified that the Air Force did assign him to the school but said that he persuaded his superiors to allow him to serve in Iraq and Afghanistan instead so he could work with a Defense Department task force on detention policy.

Graham said he kept the inaccurate job description in his biographies because he didn’t want to draw attention to his war-zone missions. Although many of his trips to Afghanistan and Iraq were documented by the news media and publicized by the Defense Department, Graham said he tried to minimize coverage for fear that the Pentagon would view his desire to serve there as a political stunt.

“I never took time to change it,” he said of his biographies. “I probably should have. At the end of the day the one thing I didn’t want to talk about was being deployed overseas. If I start putting that out there . . . I thought that would screw everything up.”

It is not the first time Graham has faced questions about distortions of his military record.

In 1998, he received criticism for indicating he had served in the Persian Gulf War, referring to himself in his Senate biography as “an Operation Desert Storm and Desert Shield veteran.”

Although Graham was called to active duty with the National Guard, he was never deployed overseas during that conflict. He stayed in South Carolina, where he prepared wills for those going into combat.

A roving prosecutor

In the Republican presidential contest, Graham is trading on his reputation as a foreign-policy expert. “I have more experience with our national security than any other candidate,” he declared at his campaign kickoff.

Among the few other current presidential candidates with military experience are former Texas governor Rick Perry (R), who served as an Air Force cargo pilot in the 1970s; former Virginia governor Jim Gilmore (R), who served in the Army in in the early 1970s; and former senator Jim Webb (D-Va.), who served in combat with the Marines in Vietnam.

The skills Graham developed as a military lawyer in the 1980s have propelled his political career. As a member of the House, he served as a prosecutor during President Bill Clinton’s impeachment trial. As a senator, he has become an influential member of the Armed Services Committee, known for his rapid-fire interrogation of witnesses.

“I was a good military lawyer long before I was a politician,” he said. “I don’t think I fall into the category of somebody who just joined the military because it was good for their political career.”

After graduating from the University of South Carolina’s law school, Graham began active duty with the Air Force in 1982. He soon drew attention for successfully challenging the Air Force’s drug-testing program in court — and appearing on the news program “60 Minutes” to expose the flaws to a national audience.

Some senior Air Force officers wanted to cashier Graham for making the service look bad, according to colleagues. But his performance impressed others, who gave him gushing marks.

“His mastery of criminal law evidence is proven in trial after trial,” an unnamed senior officer wrote in his annual performance review in 1984.

Later that year, Graham was assigned as a roving prosecutor in Europe. At one murder trial, his cross-examination of the defendant “made Perry Mason look like a beginner,” an officer wrote in Graham’s 1986 performance review.

“He was really, really talented,” said Thomas L. Hemingway, a retired Air Force brigadier general who served as a staff judge advocate in Europe when Graham was stationed there. “I would have ranked him in the top 1 percent of his peer group.”

Graham left in 1988 to become a lawyer in private practice. Not wanting to depart from the military entirely, he joined the South Carolina Air National Guard and later transferred to the Air Reserve.

‘Kicked off the court’

When he arrived in Washington in 1995 as a freshly minted congressman, Graham struggled to fulfill his military duties.

As an unpaid officer in the Air Reserve, Graham was not required to serve a fixed number of hours, according to Air Force officials. But in eight of the next 10 years, he failed to achieve what the Reserve considered “satisfactory service,” or the minimum number of hours to qualify for a pension credit.

To be promoted to lieutenant colonel or colonel, Air Force officers are generally expected to complete advanced courses at the Air War College and the Air Command and Staff College, according to interviews with several current and former Air Force lawyers.

Graham did not and was promoted anyway, according to his personnel file.

Palmer, at the Air Reserve Personnel Center, said the courses were not formally required but “may be used as a qualifier or tie-breaker when considering the merits of multiple candidates.”

Graham acknowledged he did not complete the advanced courses, which are often taken by correspondence. He said it was unrealistic to expect a member of Congress to do so.

“I’ll just be honest with you: There is no way I had the time,” he said. “If you really want to keep members of Congress and people at the level I’m serving with in the Reserves, those requirements are probably not going to be met.”

With Graham’s retirement, there are two members of Congress in the Air Reserve: Rep. Ted Lieu (D-Calif.) and Rep. Douglas A. Collins (R-Ga.). Several others serve in the National Guard or the Army, Navy or Marine Corps reserves.

In 2003, the Air Force assigned Graham to a new job: as a judge on its Court of Criminal Appeals. His workload would be unexpectedly light.

Right away, Graham’s standing was challenged by an enlisted airman who had been convicted of using cocaine. The airman argued that it was unconstitutional — a violation of the separation of powers — for a member of Congress to simultaneously hold a senior government post.

Air Force officials told Graham to stop hearing cases until the constitutional question could be resolved. “He was put in a hold status,” recalled Rives, the retired Air Force judge advocate general.

“I wanted him to be an appellate judge. I thought he was well qualified for it,” Rives added. “He was ready to do his job, but we couldn’t do it because we had to wait.”

The constitutional challenge dragged on for three years. In 2006, the U.S. Court of Appeals for the Armed Forces ruled that the senator could not stay in the post.

Graham said he was frustrated because he thought he had finally found a useful assignment. “When I got kicked off the court, we had to start all over again.”

Brief tours in combat zones

Next, Graham was reassigned as a senior instructor at the Judge Advocate General’s School in Alabama.

His personnel file states that his duties for the next three years were to provide “basic and advanced instruction in military legal practice to attorneys and paralegals.” But there is no evidence that he ever did.

Graham wanted to go overseas instead. As a senator, he had visited Iraq and saw that the war was going badly. The torture scandal at Abu Ghraib prison showed the armed forces needed help devising policies for handling prisoners, he said.

“You could see the place fall apart in Iraq,” Graham said, recalling how he heard disturbing reports from military lawyers in the field. “People said, ‘You need to come over here and see this.’ ”

An obstacle stood in his way: a Defense Department policy that prohibited legislator-reservists from serving in war zones or “imminent danger areas.” In addition, the Air Force rarely called up reservists for war duty for fewer than several months — an unrealistic option for a senator.

But Graham buttonholed senior commanders and persuaded the Pentagon to grant him waivers to its policy.

The Air Force agreed to let him deploy for unusually brief tours — between two days and two weeks — when it suited his schedule. He would travel to Iraq or Afghanistan with a congressional delegation, then stay to perform his military service.

“Bottom line is, I kept pushing and pushing and pushing,” Graham recalled. “I said, ‘Listen, I want to go over there and see what you’re doing. I think I can help.’ ”

Graham said commanders were leery but eventually began to see him as an asset. In addition to tapping his expertise in military law, they used him as a political fixer to twist the arms of Iraqi and Afghan leaders who were causing headaches, he said.

One Air Force lawyer who served in Iraq in 2006 and 2007 said it did not appear that Graham did meaningful work.

“Nobody who was in the war-zone billets who were doing [legal] work in Baghdad ever knew what he did,” said the lawyer, who is still on active duty and spoke on the condition of anonymity to avoid retaliation. “He was just hanging on.”

While in uniform, Graham was often treated like a visiting celebrity. He was featured in military news releases and posed for photographs with other units.

Graham said he focused on the task force that oversaw the detention of military prisoners. His superiors said he did invaluable work.

“He’s a national treasure,” said Richard C. Harding, a retired Air Force judge advocate general who oversaw Graham’s duties. “His contributions were huge over there.”

Last year, the Army awarded Graham a Bronze Star for serving on the detention task force. All told, he deployed overseas 19 times while in Congress, serving a total of 142 days, according to his personnel file.

Under Air Force regulations, Graham had to retire by the age of 60. He will receive a monthly pension of $2,773.

In June, the Air Force held a private retirement ceremony for Graham at the National Guard Memorial Museum in Washington. Among the attendees were Vice President Biden, Sen. John McCain (R-Ariz.) and David H. Petraeus, the former CIA director and military commander in Iraq and Afghanistan.

“I think Colonel Graham did a pretty good job, quite frankly, given the constraints of my day job, my ability in terms of time,” Graham told The Post. “I’ll let people who served with me say whether or not I helped. I think I did.”