A legally void wedding between two men has been held in a small town in the Pyrénées-Orientales, in south-western France.

The mayor of Cabestany, Jean Vila, presided over the symbolic union of Patrick, 48, and Guillaume, 37, whose surnames were withheld.

The two men exchanged rings, but their wedding will not be valid under French law, which prohibits gay marriages.

The mayor described the ceremony as a “militant act”.

He said: “There are times when it is necessary to act outside the law. Refusing homosexual marriage is to deny the reality of thousands of couples.”

Vila added: “They say France is a modern, avant garde country, but at this rate we are going to be last in Europe to legalise it.”

To avoid the marriage being subsequently anulled, the mayor decided not to record it officially.

Claude Greff, a junior minister for the family, called the ceremony a “provocation on the eve of the presidential election”.

Solidarity Minister Roselyne Bachelot said she supported the idea of gay marriages, but called the mayor’s action “not the best way to advance the cause”.

Vila is not the first mayor to officiate at an illegal gay wedding.

In 2004, the Mayor of the Bordeaux suburb of Bègles, conducted a same-sex marriage ceremony for two men, Bertrand Charpentier and Stéphane Chapin.

Noël Mamère, a former politician, was suspended from his post for a month.

In January of this year, the Constitutional Court of France decided that a same-sex marriage ban was not contrary to the Constitution, referring the question of gay marriage to Parliament.

In June, The National Assembly of France voted 293-222 against legalising same-sex marriage.

The same month, a poll by Ifop found 63% of French respondents were in favour of allowing gay marriages.