Bulgaria's parliamentary election has left the country facing more political uncertainty after a tight finish.
The centre-right Gerb party - led by former Prime Minister Boiko Borisov - is narrowly ahead with nearly all votes counted.
Gerb won nearly 31%, while the socialist BSP party got about 27%.
International observers say the vote was generally well run, but add that scandals and fraud allegations have eroded trust in state institutions.
The BBC correspondent in Sofia, Nick Thorpe, says it will be hard for either main party to form a credible coalition.
Gerb resigned in February amid protests over living standards and corruption in the EU's poorest country.
Voter turnout was barely 50% and the run-up to the election was marked by voter apathy and claims of fraud.
Bulgaria faces a major economic and social crisis, our correspondent says, with unemployment officially close to 12% but - unofficially - over 18%.
Election monitors from the Organisation for Security and Co-operation in Europe (OSCE) said in a statement the vote had been "held in a competitive environment, fundamental freedoms were respected, and the administration of elections was well managed".
But they said a pre-election bugging scandal and allegations of ballot paper fraud had "weakened public confidence in the process".
Gerb has pledged to keep debts under control, while the socialists say they will spend more and create jobs.
As polls closed on Sunday night crowds rallied outside the election centre at the Palace of Culture in Sofia to protest against any new attempt by Gerb to form a new government.
Protesters chanting "mafia" were involved in brief scuffles with police, Bulgarian news agencies said.
In order to form a new government, Gerb will need the support of parties that have already declared their opposition to another Borisov-led administration.
Two more parties passed the 4% threshold needed to enter parliament - the Movement for Rights and Freedoms (MRF), which represents Bulgaria's ethnic Turkish minority, and the ultra-nationalist Ataka. MRF got 10.7% and Ataka 7.4%.
Ballot paper 'scandal'
President Rosen Plevneliev had appealed to Bulgaria's 6.9 million voters to cast their votes to ensure a fair result.
A caretaker government has led Bulgaria since mass protests prompted Mr Borisov's resignation in February.
Before Sunday's vote, the centre-right leader had said he would be happy to go into opposition, and BSP leader Sergei Stanishev said if his party won, he would not be prime minister.
The election campaign was marred by revelations of illegal wiretapping of politicians, with prosecutors pointing the finger at former Interior Minister Tsvetan Tsvetanov.
Then, on Saturday, prosecutors said a printing house near the capital Sofia had been raided with the seizure of 350,000 ballot papers that were printed over the legally fixed number.