McCain graduated from the United States Naval Academy in 1958 and received a commission in the United States Navy. He became a naval aviator and flew ground-attack aircraft from aircraft carriers. During the Vietnam War, he almost died in the 1967 USS Forrestal fire. While on a bombing mission during Operation Rolling Thunder over Hanoi in October 1967, he was shot down, seriously injured, and captured by the North Vietnamese. He was a prisoner of war until 1973. He experienced episodes of torture and refused an out-of-sequence early release. During the war, he sustained wounds that left him with lifelong physical disabilities. He retired from the Navy as a captain in 1981 and moved to Arizona, where he entered politics.