by Sarah Rainsford and Laura Gozzi
Moldovan voters appear to have backed the Eastern European country changing its constitution and committing to joining the EU by the thinnest of margins.
Official data put Yes on 50.31% and No on 49.69% on Monday morning, with over 99% of votes counted.
Moldovan media said many of the votes yet to be counted had been cast abroad and would likely lean towards Yes, as the Moldovan diaspora is broadly in favour of closer ties with the EU.
The knife-edge nature of the vote has come as a shock to many. The referendum had been widely expected to comfortably pass in the country of 2.6 million, which borders Romania and Ukraine.
Maia Sandu, the incumbent pro-EU president, earlier denounced the narrow result as the product of foreign interference in Moldovan politics.
She said it was an "unprecedented assault on democracy", referring to widespread allegations that Russia paid people to vote a certain way, which Moscow denies.
Last month Ilan Shor, a pro-Russian Moldovan businessman and politician who now lives in Russia, said he would pay money to convince “as many people as possible” to vote No or to abstain in the EU referendum.
On Monday the Kremlin spokesman, Dmitry Peskov, said Sandu would need to present "evidence" for her claims that there had been foreign interference in the vote.
He added that the increase in the proportion of votes for Sandu was an "anomaly" that was "difficult to explain".
As well as the referendum on changing the constitution, Moldovans also voted in the country’s presidential election on Sunday.
The votes were seen as key tests for the country, which is facing a choice between pushing on with EU membership or keeping close ties to Russia.
Sandu topped the election first round but by a much lower margin than expected - 41% of the vote versus her closest opponent’s 26% - and so will now face a difficult second round in early November in which her opponents will likely unite against her.
She accused "criminal groups" of working together with "foreign forces" of using money, lies, and propaganda to sway the vote.
Sandu also said her government had "clear evidence" that 300,000 votes were bought, which she called "a fraud of unprecedented scale".
The Kremlin has staunchly denied being involved in claims of vote-buying.
Moldova is currently in talks with the EU on becoming a member. These accession talks will continue despite Sunday’s outcome, as the referendum was not legally binding.
The vote, however, was supposed to make the process irreversible. Instead, it feels a little shakier now.
Because she failed to clinch more than half of the vote, Sandu and the second frontrunner, Aleksandr Stoianoglo, who is supported by the pro-Russian Party of Socialists, will go to a run-off on 3 November.
Stoianoglo won 27%, a result that was considerably higher than expected.
Populist Renato Usatii came third, followed by the former governor of Gagauzia Irina Vlah.
If the other candidates throw their support behind Stoianoglo ahead of the second round, Sandu could run the real risk of not being re-elected.
At Sandu’s election headquarters on Sunday evening, the mood was extremely subdued, with one of her advisers describing the result so far as "not what we expected".
Sandu, who has cultivated close ties with Moldova’s EU neighbours, had campaigned for the Yes vote in the referendum. She had previously said the vote was would set up the future of Moldova for "many decades ahead".
When the first results began trickling in showing that the No vote had done better than expected, Sandu’s team put the disappointing results down to the first count coming in from villages and rural areas.
The big city count narrowed the lead for the No vote, but by 01:00 (22:00 GMT) few thought the Yes camp could still stand a chance.
Many of Sandu’s supporters left her headquarters in Chisinau where they had been hoping to celebrate her victory before the count was even over. The little EU flags they’d been given to wave have been abandoned, on chairs or strewn on the ground.
An adviser to Sandu suggested that "it looked like whatever they had planned, might have worked," referring to allegations of vote-buying, linked to Russia.
Voter turnout stood at more than 51% when polls closed at 21:00 local time (18:00 GMT), making the referendum valid.
As the night went on, the gap narrowed even further.
Several presidential candidates boycotted the referendum. Aleksandr Stoianoglo said he did not support the idea of changing the constitution - although he added he was a supporter of his country’s "European aspirations".
However, many young people queuing at polling stations on Sunday were vocal about their support for Moldova’s future as an EU member state, with some saying they were voting because they wanted to choose a European future for their country – for the sake of the economy and for more opportunities.
Some said they were fed up of being "pulled" towards Moscow, decades after the Soviet Union collapsed and Moldova became independent.
"We have to choose a European future for our country, for our children, our future – for geopolitics, for peace, that’s the most important," a voter called Oksana told the BBC. "Because we are between Europe and Russian influence, and we have to choose what we want."
At a polling station for residents of the breakaway Moldovan region of Transnistria - which is economically, politically and militarily supported by Russia - the BBC stumbled upon evidence of vote-buying.
A BBC producer heard a woman who had just dropped her ballot in the transparent box ask an election monitor where she would get paid.
Outside, we asked directly whether she had been offered cash to vote and she admitted it without qualms. She was angry that a man who had sent her to the polling station was no longer answering her calls. “He tricked me!” she said.
She would not reply when asked who she had voted for.
In September, Ilan Shor - the fugitive Moldovan businessman accused of funnelling large amounts of cash into the country from Russia - offered money to convince “as many people as possible” to vote No or to abstain in the EU referendum.
This week, Shor then made a video statement telling people to vote for "anyone but Sandu" in the presidential election.
*first published in: Bbc.com