Image copyright Getty Images Image caption Twitter has taken a "hard-line stance", French officials say

A social media campaign from the French government has been blocked by Twitter - because of the government's own anti-fake-news law.

Since December, France requires online political campaigns to declare who paid for them, and how much was spent.

But now Twitter has rejected a government voter registration campaign.

The company could not find a solution to obey the letter of the new law, officials said – and opted to avoid the potential problem altogether.

The #OuiJeVote (Yes, I Vote) campaign encouraged voters to register for the European elections ahead of the deadline.

It was operated by the French government information service, which had planned to pay for sponsored tweets, according to news agency AFP.

Twitter's refusal to take money from the state to promote the message baffled many in France. One MP, Naïma Moutchou, tweeted: "I thought it was an April Fools!"

Interior Minister Christophe Castanter also took to the platform to express frustration with the decision.

"Twitter's priority should be to fight content that glorifies terrorism. Not campaigns to register on the electoral lists of a democratic republic."

Sorry, this Twitter post is currently unavailable.

The new French law, which took effect in December, is designed to combat anonymous political messages and make clear who is paying for advertisements.

It requires online platforms to provide "fair, clear and transparent" information about the person or company, and the amount paid, in an open and accessible database format.

The government information service told AFP news agency: "Twitter does not know how to do that today, and so decided to have a completely hard-line policy, which is to cut any so-called political campaign."

But it argued that the public information message, simply asking people to register to vote, should not count as a "political campaign".

"It's not that the law has backfired against us, it's a platform which does not comply," it said.

"In our opinion, this is a last stand on their part to put the discussion back on the table, with the aim of adjusting the measures."

Twitter's own guidelines on European political content state that political campaign advertisers should go through a special certification process. Issue advocacy ads not supporting or targeting individual people or parties are generally allowed without restriction.

However, it also clearly states that both types of adverts are not allowed in France.