Albania's parliament on Friday elected speaker Ilir Meta as the Balkan country's new president, a largely ceremonial post for which he was supported by the governing Socialist party.
A former prime minister and leader of the Socialist Movement for Integration, a junior coalition partner, 48-year-old Meta was elected to the post in the fourth ballot to choose a president.
No candidate was presented in the earlier three rounds owing to a bid to form a consensus with the rightwing opposition, which has boycotted parliament since mid-February because it wants Prime Minister Edi Rama to resign.
With a general election due on June 18, the opposition says Rama, who leads the Socialists, must step down to allow a transitional government to take power and allow a free and fair vote.
The boycott continued Friday, but Meta nevertheless won support from 87 deputies in the 140-seat assembly.
"I pledge to do everything possible for the stability of the country," Meta said, pledging that he would try to help find a compromise between political groups so that they would all take part in the June vote.
The opposition, which is holding regular protests, refuses to take part in the electoral process unless Rama resigns.
They accuse the premier of allowing the expansion of cannabis cultivation in Albania to raise money to manipulate voting.
Rama accuses his opponents of trying to hinder the implementation of judicial reform, a crucial step towards European Union accession.
A NATO member since 2009, Albania is a candidate for EU membership and hopes to open negotiations by the end of the year.