WASHINGTON — Sen. John McCain spent his congressional career, which spanned six presidential administrations and more than three decades, as a member of the Republican Party — but one who didn't always hew to the official party line.

He served in the House from 1983 to 1987, spending the rest of his political career, through his death this weekend, in the Senate, representing Arizona. McCain’s six terms in that chamber included two presidential campaigns of his own — in 2000 and 2008 — and stints as chairman of the Armed Services, Indian Affairs, and Commerce committees.

His time on Capitol Hill — where he'll lie in state before his burial next week — was most notable for its moments of independence, culminating in his vote last summer that ultimately doomed his party’s efforts to destroy Obamacare that year.

John McCain speaks on the floor of the U.S. Senate after returning to Washington for a vote on health care reform on July 25, 2017. Senate TV via Reuters file

Here are some highlights of his epic Hill career:

Campaign finance reform

McCain was a member of a group of senators known as the Keating Five that was investigated in the late 1980s and early ’90s for meeting with federal bank regulators on behalf of a savings-and-loan chairman and donor. The scandal nearly ended McCain’s political career, but the experience inspired him to pursue changes to campaign finance laws.

In a 1997 speech on the Senate floor, McCain said that money in politics should motivate all public officials to repair the “appearance and the reality of government corruption.”

"As long as the wealthiest of Americans or the richest organized interest can make six-figure contributions to political parties and gain the special access to power such generosity confers on the donor, most Americans will dismiss even the most virtuous politician's claim of fairness and patriotism,” he said.

After spending years calling for campaign finance reform, he worked with Sen. Russ Feingold, D-Wis., on critical legislation that limited money in politics and was signed into law in 2002 by President George W. Bush. The bill banned so-called soft money, prohibiting national party committees from raising or spending funds not subject to federal limits, and placed new restrictions on campaign ads.

Normalizing relations with Vietnam

After spending six years being tortured as a prison of war in North Vietnam until 1973, McCain first returned to Vietnam in 1985 during the 10th anniversary of the fall of Saigon with CBS News anchor Walter Cronkite. He later served on the Senate Select Committee on POW/MIA Affairs, which investigated issues surrounding Americans who were taken as prisoners or were listed as missing during the Vietnam War.

Together with fellow Vietnam veteran Sen. John Kerry, D-Mass., McCain pushed for the normalization of relations with Vietnam in the mid-1990s, first co-sponsoring a non-binding resolution in 1994 to end the U.S. economic embargo against Hanoi and later calling on President Bill Clinton to formally recognize the country.

John Kerry and John McCain examine a book containing the names the "total unaccounted for" soldiers who served in the Vietnam War on June 24, 1992. Robert Giroux / AFP - Getty Images file

After 20 years of no diplomatic relations between the two nations, Clinton announced the formal normalization of U.S. relations with Vietnam in 1995, followed by the opening of an American embassy in Hanoi.

Immigration reform

McCain was an integral member of the bipartisan Gang of Eight group that crafted a legislative overhaul of the country’s immigration system that eventually passed the Senate in 2013, though then-House Speaker John Boehner, R-Ohio, decided not to take up the legislation in the House.

McCain had also pushed for comprehensive reform in 2006 along with Kennedy and several other Senate colleagues. Due to his treatment for brain cancer, McCain was last on Capitol Hill in December 2017 and therefore missed several immigration votes that failed anyway on the Senate floor. The senator was especially critical of President Donald Trump’s decision last year to end the Deferred Action for Childhood Arrivals program, which had deferred deportations for 800,000 people who came to the U.S. illegally as children.

Calling for bipartisanship

Following the news about his cancer diagnosis last summer, McCain returned to Washington at the height of the health care debate in the Senate and as Republicans prepared to force floor votes on legislation to roll back Obamacare.

McCain voted to open debate on the health care proposals, but soon derided members of his own party for partisanship, calling for a return to compromise in a widely-lauded speech.

"We're not getting much done apart. I don't think any of us feels very proud of our incapacity. Merely preventing your political opponents from doing what they want isn't the most inspiring work,” he said. “And the times when I was involved even in a modest way with working out a bipartisan response to a national problem or threat are the proudest moments of my career, and by far the most satisfying.”

The decisive vote against an Obamacare repeal

On July 27, 2017, after days without revealing how he would vote on a bill that would repeal parts of the Affordable Care Act, McCain approached the dais of the Senate chamber and cast a decisive “no” vote with a thumbs down, a jaw-dropping move that surprised and angered his GOP colleagues.

Afterward, he said in a statement that he could not back the GOP measure because it offered no replacement to reform the nation’s health care system.

“We must now return to the correct way of legislating and send the bill back to committee, hold hearings, receive input from both sides of aisle, heed the recommendations of nation’s governors, and produce a bill that finally delivers affordable health care for the American people," he said. 'We must do the hard work our citizens expect of us and deserve."