The tiny state of San Marino has voted to allow abortion in a historic referendum result that brings the predominately Catholic country in line with most of the rest of Europe.

With final results declared, 77.28% of voters approved a motion to allow the termination of a pregnancy up to 12 weeks.

After the 12-week mark, abortion would only be allowed if the mother's life was in danger or in the case of foetal abnormalities that could harm the woman physically or psychologically.

The picturesque republic, situated on a mountainside in the centre of Italy, was one of the last in Europe along with Malta, Andorra and the Vatican to have a total ban on terminating a pregnancy.

More than 35,000 voters, a third of them living abroad, were eligible to vote in the referendum initiated by the San Marino Women's Union (UDS). The turnout was just over 41%, the ministry figures showed.

In the absence of opinion polls, nobody had wanted to call the result beforehand.

The influence of the Catholic Church remains strong there, and Pope Francis last week reiterated his uncompromising position that abortion is "murder".

Before the result came in, Francesca Nicolini, a 60-year-old doctor and member of UDS, had argued: "The majority of young people are on our side, because it's an issue that directly affects their lives.

"It's unacceptable to view as criminals women who are forced to have abortions."

After the result, campaigners for the change wanted swift action in parliament.

"It's a clear victory," campaigner Vanessa Muratori told local television. "We are now waiting for a law to match the results."

Currently, abortion carries a penalty of up to three years in prison for the woman and six years for the doctor who conducts the procedure.

However, nobody has ever been convicted. Women who choose to have an abortion typically cross into Italy, where it has been legal for more than 40 years.

Opposition to decriminalising abortion was led by the ruling Christian Democratic Party, which has close ties to the Catholic Church and which called for a 'No' vote to "defend the right to life".

But its deputy secretary Manuel Ciavatta said before the referendum that his party, which has just over a third of MPs, would respect the result.

"The population is very divided on the issue," he said last week.

"And even in parliament, there are members of progressive parties who are against abortion, and MPs from the right who are in favour of abortion rights, notably in cases of rape or foetal abnormalities."

His party would "respect the voice of the voters", he added.

Parliament must now act to make the change law.