Eric Fanning made history last week when he was unanimously confirmed by the U.S. Senate to his role the 22nd Secretary of the Army, becoming the first openly gay person to hold the role of service secretary.

His confirmation was directly facilitated by the powerful war hero who chairs the Senate Armed Services Committee, Arizona Republican Sen. John McCain.

At varying points over the past five months that Fanning has awaited Senate confirmation, McCain has impeded or facilitated Fanning’s confirmation. The entire ordeal amounted to a showcase of McCain’s power and influence as chairman of the Senate Armed Services Committee and ultimately culminated in a display of bipartisanship that enabled Fanning to make history.

Fanning’s confirmation was fraught for months. He was nominated for the role by President Barack Obama in September 2015. McCain himself initially placed a hold on many civilian Pentagon nominees, including Fanning, citing protest over Democratic changes to the confirmation process, as well as the president’s threat to veto the 2016 policy bill, according to Defense News.

Related: McCain Calls On Trump To Apologize To Vets For Inflammatory Comments »

In November 2015, Fanning began performing the duties of his office, assuming the role of acting secretary of the Army. This action caused McCain to block Fanning for the role once again, arguing that Fanning’s presence in the job violated federal law.

Recommended

In The Military? Tips For Saving Money At Every Stage

Think Your Absentee Ballot Doesn’t Matter? Here’s Proof It Does

9 Ways To MacGyver Your Life With A Rip It Can

10 Essential Fieldcraft Survival Tips, According To A Veteran

How This Soldier Used His Military Skills To Build A Career And Serve Veterans At Sodexo

“I wasn’t going to have a hearing while they were in violation of the law; That’s sort of fundamental to the way I do business,” McCain said at the time, according to a January 12 Defense News report. “You don’t put people in jobs until they are confirmed by the Senate. That’s pretty straightforward.”

Fanning stepped down in January 2016 to satisfy McCain’s concerns and facilitate his confirmation, only to face another hold on his confirmation, this one from Sen. Pat Roberts, a Republican from Kansas. Roberts held Fanning’s confirmation hostage over assurances from the Obama administration that no detainees in the military prison at Guantanamo Bay, Cuba, would be transferred to Fort Leavenworth, Kansas, Roberts’ home state.

This is where McCain switched from impeding Fanning’s nomination to actively advocating for it. McCain advocated behind the scenes for months to persuade Roberts, a longtime senator from his own party, who he described as a friend, to drop the hold. Then, last month, that dispute came to a public head on the Senate floor. McCain cornered Roberts over the hold, telling him that his committee would ensure there was no transfer of detainees from Guantanamo Bay to Kansas, and reminding him that the secretary of the Army has no role in determining where the detainees are held.

“Mr. Fanning has nothing to do with the issue. So we’re shooting a hostage that is being held that has nothing to do with the decision-making process. If we inaugurate a practice here of holding nominees over an issue that is not related to those nominees, we are abusing our power and authority as United States Senate,” McCain told Roberts. “What we’re doing here is we’re telling a nominee, who is totally qualified, totally eminently qualified for the job that that person cannot fulfill those responsibilities and take on that very important leadership post because of an unrelated issue that has nothing to do with Mr. Fanning. That is not the appropriate use of senatorial privilege.”

Roberts stuck to his guns, but roughly two weeks later, McCain said that the two men had reached an agreement, according to Defense News.

“We just had some good conversations and wanted to make sure that the language in the defense bill was satisfactory,” McCain said. “We’re old friends and we worked it out.”

Shortly thereafter, Roberts dropped his hold on the nomination. Fanning was unanimously confirmed by voice vote on May 17.

McCain was right when he called Fanning “totally, eminently qualified” for the role. Fanning has served in numerous leadership positions within the Pentagon, just in the span of the past seven years of the Obama administration. In addition to being the acting secretary of the Army, Fanning served as chief of staff to Secretary of Defense Ash Carter, the acting secretary of the Air Force, under secretary of the Air Force, and deputy under secretary of the Navy.

It was unusual for a candidate so well qualified to face such a protracted confirmation for an important role. Equally unusual, however, in a political discourse increasingly crippled by partisan gridlock, was McCain’s bipartisan leadership in ultimately ensuring Fanning was confirmed.