Polls have closed in Moldova, where people have been voting in the country’s presidential election and in a referendum on whether to enshrine the goal of joining the European Union in the constitution.

With almost 90% of the referendum votes counted, the No vote was ahead with 53.9%, according to data shared by Moldova’s electoral commission.

A No victory would come as a surprise to many, as several recent surveys said 63% of voters would back the Yes campaign.

Referring to widespread allegations of vote-buying linked to Russia, pro-EU President Maia Sandu said on Sunday evening that Moldova had faced an “unprecedented assault” on its democracy.

She accused “criminal groups” of working together with “foreign forces” of using money, lies, and propaganda to sway the vote.

She 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 claims of vote-buying.

In the presidential election, over 90% of the votes counted so far seem to indicate that Sandu has come out top.

But she has failed to clinch more than half of the vote – meaning she and the second frontrunner, Aleksandr Stoianoglo, who is supported by the pro-Russian Party of Socialists, would go to a run-off on 3 November.

Stoianoglo may have won a result of almost 30%, higher than expected.

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”.

Initially, Sandu’s team explained her less-than-expected result as down to the first count coming in from villages. But the big city count hasn’t altered the picture much – hence the glum mood.

The adviser suggested that “it looked like whatever they had planned, might have worked,” referring to allegations of vote-buying, linked to Russia.

Moldova’s foreign ministry announced that voting had to be extended in Moscow, as well as at two polling stations in Romania and one in France – due to the large numbers of expat voters still in the queue. This slightly delayed the count.

Voter turnout stood at more than 51% when polls closed at 21:00 local time (18:00 GMT), making the referendum valid.

After casting her ballot in the Moldovan capital Chisinau earlier on Sunday, Sandu singled out the referendum vote as one that would set up the future of Moldova for “many decades ahead”.

Several presidential candidates said they would boycott 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”.

Many young people queuing at polling stations said 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 given 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.