McCain entered the race for the Republican nomination for president in 2000, but lost a heated primary season contest to Governor George W. Bush of Texas. He secured the nomination in 2008 after making a comeback from early reversals, but was defeated by Democratic nominee Barack Obama in the general election, losing by a 365–173 electoral college margin.