Carolyn Kaster/AP

John McCain’s life in pictures

Carolyn Kaster/AP

War hero. Statesman. Maverick.

For more than 30 years, John McCain was one of the leading voices in American politics.

The US senator from Arizona ran for President twice, winning the Republican nomination in 2008. He lost the election to Barack Obama, but his political career was far from over.

He continued to serve in Congress for another decade, even after being diagnosed with brain cancer last year.

McCain died in August 2018 at the age of 81.

See photos from his life and career:

McCain sits on a sofa with his sister, Sandy, in a reproduction of a family photo taken around 1938. McCain was born in 1936 to Roberta McCain and John McCain Jr., a Navy admiral. Terry Ashe/The LIFE Images Collection/Getty Images

McCain sits with his grandfather and his father, both of whom were Navy admirals, in this family photo from the 1940s. Terry Ashe/The LIFE Images Collection/Getty Images

McCain, bottom right, poses with his Navy squadron in 1965. McCain graduated from the US Naval Academy in 1958 and served in the Navy until 1981. Library of Congress/AP

During the Vietnam War, McCain's plane was shot down and captured by North Vietnamese forces. Here, he is pulled out of a lake in Hanoi by North Vietnamese soldiers and civilians in October 1967. McCain broke both arms and his right leg upon ejection and lost consciousness until he hit the water. After he was pulled to land, he was beaten and taken as a prisoner of war. Getty Images

McCain, as a prisoner of war, lies in a Hanoi hospital bed in 1967. He was held for five years by the North Vietnamese and tortured. Because he was an admiral’s son, he was offered early release by his captors. But he refused, sticking with the US military’s code of conduct that says POWs should only accept release in the order that they were captured. AFP/Getty Images

McCain retired from the Navy in 1981 and was elected to the US House of Representatives in 1982. Here, he talks to people in Hanoi during the filming of the CBS special "Honor, Duty and a War Called Vietnam” in 1985. CBS Photo Archive/Getty Images

McCain, running for the US Senate in 1986, meets with President Ronald Reagan in the White House Oval Office. Reagan was meeting with many Republican candidates. Library of Congress

Vice President George H.W. Bush re-enacts a Senate swearing-in with McCain in 1986. They are joined by McCain’s wife, Cindy, and two of his children. Cynthia Johnson/The LIFE Images Collection/Getty Images

McCain, bottom, attends a hearing of the Senate Ethics Committee in 1990. McCain was investigated as being one of five senators, called the Keating Five, who interfered with regulators on behalf of Charles Keating, a financier accused of financial violations and convicted of securities fraud. McCain was cleared, but the Senate Ethics Committee decided that McCain showed poor judgment in his efforts for Keating, who was a large contributor to McCain's campaign. John Duricka/AP

McCain testifies before a Senate subcommittee in 1995. Maureen Keating/CQ Roll Call/Getty Images

McCain chats with fellow Sen. John Kerry in Washington in 1997. David Hume Kennerly/Getty Images

McCain talks in April 1998 about a bill he sponsored regarding the tobacco industry. The bill, which would have added strict regulations on the industry while limiting its future liability, did not get enough votes in the Senate. Karin Cooper/Getty Images

McCain talks to his schedule-maker via speakerphone in May 1998. Scott J. Ferrell/Congressional Quarterly/Getty Images

McCain spends time with his wife and children at their home in Phoenix in October 1999. John and Cindy McCain had two daughters, Meghan and Bridget, and two sons, Jack and Jimmy. The senator also had three children from a previous marriage: Andrew, Douglas and Sidney. Karin Cooper/Getty Images

McCain rests in a New Hampshire motel room while campaigning for president in November 1999. Karin Cooper/Getty Images

President Bill Clinton is greeted by McCain at the annual Radio/TV Correspondents Dinner in April 2000. Mario Tama/AFP/Getty Images

McCain celebrates with his wife and his daughter Bridget on the evening of the Super Tuesday primaries in March 2000. He suspended his campaign two days later and eventually endorsed George W. Bush. Win McNamee/Reuters/Newscom

McCain mans the grill at the family’s ranch near Sedona, Arizona, in March 2000. David Hume Kennerly/Getty Images

McCain and his wife host George W. Bush and his wife, Laura, at Arizona's Red Rock Crossing in August 2000. Bush, of course, went on to win the presidency. Paul J. Richards/AFP/Getty Images

McCain acts in a skit while hosting "Saturday Night Live" in 2002. Dana Edelson/NBC/NBCU Photo Bank/Getty Images

President Bush is joined by McCain, US Sen. Barack Obama and congressional leaders from both parties as he makes remarks on the economic crisis in September 2008. Months earlier, McCain won the GOP’s presidential nomination. Obama was the Democratic nominee. Tim Sloan/AFP/Getty Images

McCain salutes the crowd at a campaign rally in Mentor, Ohio, in October 2008. Carolyn Kaster/AP

McCain prepares for an interview with local media in Blue Bell, Pennsylvania, in October 2008. Richard Perry/The New York Times/Redux

McCain debates Obama during a presidential debate in October 2008. Damon Winter/The New York Times/Redux

McCain, joined by running mate Sarah Palin, speaks to a crowd in Phoenix as he gives his concession speech in November 2008. McCain won 22 states and lost the electoral vote 365-173. Mike Blake/Reuters/Newscom

McCain is flanked by fellow Sens. Joe Lieberman, left, and Lindsey Graham during a Fiscal Responsibility Summit hosted by President Obama in February 2009. Saul Loeb/AFP/Getty Images

McCain and US Sen. Mitch McConnell speak about health-care reform in December 2009. They were expressing disappointment at the time that Democrats were not including Republicans in the drafting of new legislation. Mark Wilson/Getty Images

McCain takes the stage to speak at the Republican National Convention in August 2012. Mark Wilson/Getty Images

McCain, seen here with actress Amy Poehler, played himself in an episode of the TV show “Parks and Recreation” in September 2012. David Giesbrecht/NBC/NBCU Photo Bank/Getty Images

McCain and Secretary of State Hillary Clinton talk during a hearing of the Senate Foreign Relations Committee in January 2013. Andrew Harrer/Bloomberg/Getty Images

McCain plays poker on his iPhone during a Senate committee hearing in September 2013. Melina Mara/The Washington Post/Getty Images

McCain and actor Jamie Foxx dance on stage at the Apollo in the Hamptons fundraiser in 2014. Kevin Mazur/WireImage/Getty Images

McCain gives "devil horns" to Sen. Cory Gardner as he poses for a photo during President Donald Trump's inauguration in January 2017. Drew Angerer/Getty Images

McCain talks with fellow Sens. Ben Sasse, center, and Tom Cotton in Washington in May 2017. Mark Wilson/Getty Images

Less than two weeks after surgeons removed a large blood clot from his brain and diagnosed him with brain cancer, McCain returned to the Senate floor in July 2017. He received a standing ovation on both sides of the aisle. Chip Somodevilla/Getty Images

McCain is pursued by reporters after voting no on the GOP's "skinny repeal" health-care bill in July 2017. He was one of three Senate Republicans who broke ranks and voted against the failed bill. The others were Susan Collins and Lisa Murkowski. Cliff Owen/AP

McCain leads a confirmation hearing for Mark Esper, who later became secretary of the US Army, in November 2017. Chip Somodevilla/Getty Images

McCain arrives on Capitol Hill in December 2017. He suffered an Achilles tendon tear on his right side and had to wear a walking boot. In this photo, he's wearing the boot on his other leg. He said on Twitter that it was to give a break to his left leg, which was tired from compensating for his injury. Al Drago/The New York Times/Redux

"No place I would rather be," Meghan McCain tweeted with this photo of her and her father in March 2018. After leaving Washington in December 2017, McCain was in Arizona recovering from cancer treatment. From Meghan McCain/Twitter