The party lost the 1998 elections, but at the legislative elections, 15 September 2002, the party became the strongest party winning 60 out of 120 seats in the Assembly of Macedonia as the major party of the Together for Macedonia alliance, led by SDSM and the Liberal Democratic Party. Together for Macedonia ruled in coalition with the Democratic Union for Integration. The longstanding former leader of the party was Branko Crvenkovski, who served as prime minister of Macedonia from 1992 to 1998 and from 2002 to 2004. Crvenkovski was then elected on the Social Democratic ticket to become President of Macedonia a post that he held until May 2009. The Presidency was handed to Vlado Bučkovski, who was the party leader and Prime Minister until the 2006 Parliamentary elections. The SDSM is a member of the Progressive Alliance and an associate affiliate of the Party of European Socialists. On 30 November 2005 one of the most prominent members of the SDSM, Tito Petkovski, who ran for president in 1999 and came in second place, left the party to form the New Social Democratic Party. This is the second major split from the SDSM, the first one being the 1993 split of Petar Gošev, who has established the Democratic Party. At the parliamentary elections in North Macedonia held in 2008, the coalition Sun was defeated, receiving 27 of the 120 seats. At the last local elections from 2009, the Social Democrats won in 8 out of 84 municipalities in the country. The Social Democratic Union of Macedonia is the second largest political party and the main opposition party in the country. In May 2009, after finishing the 5-year-term of President of the Republic of Macedonia, Branko Crvenkovski returned to the SDSM and was reelected leader of the party. He reorganized the party profoundly, but resigned after the party's defeat in the 2013 local elections. In June 2013, Zoran Zaev was elected as the new leader. The party was defeated in the 2014 general elections by the VMRO–DPMNE, but the results were not recognized and the opposition parties boycotted the Parliament. From February to May 2015 Zaev released wiretapped material that alleged Prime Minister Nikola Gruevski for illegally spying more than 20,000 citizens. In May, large protests including SDSM members began in Skopje. Large crowds gathered to protest on May 17, demanding resignation from Gruevski, who refused to step down and organized a pro-government rally the following day. The number of protesters was estimated to be more than 40,000. Zaev claimed the number of protesters reached 100,000, and said that some of them will remain there until Gruevski resigns. European Union diplomats offered to mediate a solution to the crisis. The political crisis was exceeded with the Pržino Agreement from July 2015, which obliged a transitional government with SDSM from November 2015, resignation from Gruevski in January 2016, and an early parliament elections on 11 December 2016. On the elections on 11 December 2016 the party won almost 440 000 and 49 MP which was the second best result in SDSM's history, after the result from 2002. In February 2017, Zaev began negotiations with junior partners to form parliament majority. Prior to the 2020 parliamentary elections, the party rebranded, changing its logo to be similar to other European social-democratic parties, and changing its primary colour to red.