Borisov was elected Mayor of Sofia in 2004. In December 2005, he was the founding chairman of the conservative political party Citizens for European Development of Bulgaria (GERB), becoming its lead candidate in the 2009 general election. Borisov led GERB to a landslide victory in 2009, defeating the incumbent Socialist Party, and resigned as mayor of Sofia to be sworn in as Prime Minister. He resigned in 2013, after nationwide protests against the government's energy policy, but after leading GERB to victory in the 2014 general election, he became Prime Minister again. His second term ended similarly to his first, after Borisov resigned in January 2017, this time following GERB's defeat in the 2016 presidential election. As before, Borisov led GERB to election victory again in the snap 2017 general election, becoming Prime Minister for a third time.