In 1982, McCain was elected to the United States House of Representatives. He represented Arizona. In 1987, he became a U.S. Senator for Arizona. In 2000, McCain tried to be the Republican Party candidate for President of the United States, but George W. Bush was chosen. In 2008, he was chosen as the Republican candidate. His running mate was Sarah Palin. He opposed several foreign policies of the Obama administration. On November 4, 2008, he lost to Barack Obama.