Republican presidential candidate Senator John McCain (R-AZ) delivers remarks at the U.S. Naval Academy in Annapolis, Maryland, April 2, 2008. Jason Reed | Reuters

Son and grandson of admirals, Navy aviator, POW, congressman, senator, presidential candidate. And maverick. That was John McCain. McCain died Saturday. He was 81. The Republican senator from Arizona literally lived the nation's history — from turbulent days of the Vietnam War era to the tumultuous times of the Trump administration. McCain was praised by admirers as a true American hero and by detractors and supporters alike as a man who stood by his beliefs. Here's a look at the life and times of John Sidney McCain III through pictures.

Navy aviator

John McCain (Bottom R) poses with his U.S. Navy squadron in 1965. National Archives | Reuters

McCain graduated from the U.S. Naval Academy in 1958 and was commissioned as an ensign. In this 1965 photo, he poses with his Navy squadron. Two years later, he survived the June 29, 1967, fire on the USS Forrestal that killed 134 servicemen.

Shot down

After his plane was shot down, McCain is pulled out of a Hanoi lake by North Vietnamese soldiers and civilians in this October 1967 file photo. Reuters

McCain is pulled out of a Hanoi lake by North Vietnamese Army troops and Vietnamese citizens in this October 1967 photo. After his A-4E Skyhawk was shot down by a missile, McCain said, "I pulled the ejection handle, and was knocked unconscious by the force of the ejection — the air speed was about 500 knots."

POW in Vietnam

American pilot John McCain recovers in a Hanoi Hospital from injuries he sustained when he was shot down over Hanoi. Bettman Collection | Getty Images

After being interrogated, beaten and bayoneted in a foot, McCain recalled, he was denied medical care until his captors found out he was the son of an admiral. They then took him to a hospital, where this picture was taken. He was a POW for nearly six years in places including the notorious "Hanoi Hilton."

A war hero comes home ...

President Richard Nixon greets former Vietnam prisoner of war John McCain at a pre-POW dinner reception in Washington, May 24, 1973. National Archives | Reuters

As part of the negotiations to end the war, McCain was among the U.S. prisoners released by North Vietnam in 1973 under Operation Homecoming. In this photo, McCain is greeted by President Richard Nixon in Washington, May 24, 1973.

... and goes to Capitol Hill

Vice President George H.W. Bush (R), re-enacting Senate Swear- In with Sen. John S. McCain and his family. Cynthia Johnson | The LIFE Images Collection | Getty Images

McCain entered politics in 1982 by winning the seat left vacant by the retirement of House Minority Leader John Rhodes. McCain served two terms before being elected to the Senate in 1987, succeeding Barry Goldwater. In this photo, Vice President George H.W. Bush re-enacts the swearing-in of McCain as the family of the newly elected senator from Arizona looks on.

Keating Five

Sen. John McCain (Rep-AZ), re implication in Lincoln Savings & Loan ethics investigation. Terry Ashe | The LIFE Images Collection | Getty Images

In the late 1980s, McCain was one of the "Keating Five" senators accused of improperly intervening on behalf of Phoenix savings and loan executive Charles Keating in an investigation by the Federal Home Loan Bank Board. McCain, whose campaigns had received $112,000 in donations from the S&L executive, sat in on two meetings with the regulators in the Keating matter. After a 14-month investigation, the Senate Ethics Committee exonerated him in 1991 but reprimanded him for using "poor judgment."

Presidential hopeful

Republican presidential candidate Texas Gov. George W. Bush (L) and vanquished contender Sen. John McCain (R-AZ) joke as they answer questions from the media during a press conference in Pittsburgh May 9. McCain endorsed his former political rival Texas Gov. Bush as the Republican U.S. presidential nominee, but said he would not be Bush's running-mate. Jason Cohn | Reuters

McCain first ran for president in 2000 but pulled out in the race for the GOP nomination on May 9, 2000. In this photo, he and then-Texas Gov. George W. Bush joked at a news conference in Pittsburgh, where McCain endorsed his former political rival.

McCain revisits the 'Hanoi Hilton'

Vietnam war veteran and former Republican presidential frontrunner, Senator John McCain of Arizona steps down a dark corridor separating jail cells with his son Jack during a tour of the infamous "Hanoi Hilton" jail April 26 where he spent time as a prisoner of war. Jason Reed | Reuters

McCain returned to Vietnam several times. Marking the 25th anniversary of the end of the war, McCain visited the "Hanoi Hilton" in April 2000. In this photo, he steps down a dark corridor separating jail cells, followed by his son Jack. During the visit, McCain said he could not forgive the jailers who mistreated and killed his comrades.

Maverick runs again

Alaska Gov. Sarah Palin speaks as presumptive Republican presidential nominee John McCain looks on at a campaign rally August 29, 2008 in Dayton, Ohio. McCain announced Palin as his vice presidential running mate at the rally. Mario Tama | Getty Images

In 2008, McCain made a second run for the White House, eventually losing to a freshman Democratic senator from Illinois — Barack Obama. On Aug. 29, 2008, one day after the Democrats nominated the first African-American presidential candidate, Republican McCain selected Alaska Gov. Sarah Palin as his pick for vice president in hopes of energizing his flagging campaign. In this photo, he introduces Palin as his running mate.

Political rivals meet

Former Republican presidential candidate Sen. John McCain (R-AZ) (L) meets with President-elect Barack Obama at Obama's transition office November 17, 2008 in Chicago, Illinois. Obama is meeting with McCain for the first time since beating McCain in the presidential election. Getty Images

McCain meets with the then-president-elect at Obama's transition office in Chicago on Nov. 17, 2008.

Health-care repeal

Sen. John McCain, R-Ariz., and Senate Minority Leader Mitch McConnell, R-Ky., during a news conference on health care overhaul. Scott J. Ferrell | Congressional Quarterly | Getty Images

In this December 2009 photo, McCain and Senate Minority Leader Mitch McConnell, R-Ky., appear at a news conference to talk about repealing the Affordable Care Act. More than seven years later, in July 2017, McCain cast the decisive vote that killed one of the GOP's attempts to repeal and replace Obamacare. "I thought it was the right thing to do," the maverick McCain said.

Brain cancer and health care

(L-R) Sen. Lindsey Graham (R-SC), Sen. Ron Johnson (R-WI), Sen. Bill Cassidy (R-LA) and Sen. John McCain (R-AZ). Getty Images

McCain announces his opposition to the "skinny repeal" of Obamacare, July 27, 2017.

Hero's medal

Sen. John McCain (R-AZ) receives the the 2017 Liberty Medal from former Vice President Joe Biden at the National Constitution Center on October 16, 2017 in Philadelphia, Pennsylvania. Getty Images

Former Vice President Joe Biden presents McCain with the Liberty Medal at the National Constitution Center in Philadelphia in October 2017. At the ceremony, McCain took issue with the nationalist and isolationist policies that Trump campaigned on to win the White House. Without mentioning Trump by name, McCain said: "To fear the world we have organized and led for three-quarters of a century, to abandon the ideals we have advanced around the globe, to refuse the obligations of international leadership and our duty to remain 'the last best hope of earth' for the sake of some half-baked, spurious nationalism cooked up by people who would rather find scapegoats than solve problems is as unpatriotic as an attachment to any other tired dogma of the past that Americans consigned to the ash heap of history."

An American Maverick: 1936-2018