A former National Front candidate in his 80s was being questioned by French police after shots were fired at a mosque in Bayonne, injuring two elderly worshippers inside.

The suspect fired at the victims after they thwarted an arson attempt at the doors of the building during preparations for afternoon prayers, prosecutors said.

The victims, aged 74 and 78, were taken to hospital where they ere in a serious condition.

Police arrested the suspect at his home in Saint-Martin-de-Seignanx, a town of 5,000 inhabitants about 10km north of Bayonne, in the neighbouring department of Landes.

The suspect, who was identified by local media and police sources, stood as a local candidate in Seignanx for the FN — now called Rassemblement National — in 2015, the party confirmed in a statement.

However, he was removed from the party "for making remarks deemed contrary to the values and political line of the Rassemblement National," it added.

Mike Bresson, deputy mayor of the town, said the suspect was notorious locally. "He gave the appearance of someone psychologically disturbed," he told AFP. "He did not like people on the left or in the centre, and not many on the right."

Local newspaper Sud-Ouest said he had recently sent an "angry" letter to its offices, and to local officials, that it declined to published because it was "discriminatory and xenophobic".

The attack happened on Monday afternoon. "At 15h30, a man tried to set fire to the door of Bayonne's mosque; the perpetrator fired at two people who caught him in the act," said a statement by the prefecture of Pyrenees Atlantique.

Interior Minister Christophe Castaner tweeted he was "angry" at the events in Bayonne and sent his thoughts to those injured and their families.

Marine Le Pen, the leader of the far-right Rassemblement National party, said the attack against Bayonne's mosque was "an unspeakable act that is absolutely contrary to all the values of our movement. These crimes must be treated with the utmost severity."

Mike Bresson, deputy mayor of the village of the Landes, said that the man was "known on the town and fled for his verbal excesses." "He gave the appearance of someone psychologically disturbed (...) He did not like people left, centre and few right ones," according to the elected.