Guterres served as secretary-general of the Socialist Party from 1992 to 2002. He was elected prime minister of Portugal in 1995 and resigned in 2002 after the Socialist Party was defeated in the 2001 Portuguese local elections. After six years governing without an absolute majority and with a bad economy, the Socialist Party did worse than expected because of losses in Lisbon and Porto, where polls indicated they had a solid lead. Eduardo Ferro Rodrigues assumed the Socialist Party leadership, but the general election was lost to the Social Democratic Party, led by José Manuel Barroso.