A French court has ruled that schools should provide an alternative to pork school lunches in the interest of Muslim and Jewish children who do not eat the meat.

The decision came after a rightwing local authority stopped providing a choice for children.

On Monday a Muslim organisation won its legal case against the authority at Chalon-sur-Saône in Burgundy. The court, sitting in Dijon, annulled the town hall’s 2015 decision not to provide an alternative to pork in its school canteens.

Chalon-sur-Saône officials said they would appeal against the decision.

The judge said he was not concerned with religious considerations but ruled that the town’s failure to provide an alternative meal, which meant many local Muslim children went without lunch, was “not in keeping with the spirit of the international convention on the rights of children” and was not “in the interests of the children”.

At a hearing on Friday, a state legal expert told the court they had come to the same conclusion.

Gilles Platret, the mayor of Chalon-sur-Saône for the rightwing Les Républicains party, claimed he was upholding the French Republic’s principle of “laïcité”, or secularism, when he decided to stop offering non-pork alternatives in the local schools.

“The decision comes only a few days before the start of the term. It is materially impossible for the town of Chalon-sur-Saône to change the operation of a public service in such a short time without risking the continuity of that service,” Platret said in a statement on Monday.

The council insisted that by making all children eat together they were combating separation and discrimination.

The Ligue de Défense Judiciaire des Musulmans (LDJM – the Muslim Legal Defence League) rejected this and brought the legal action in 2015, claiming that the town hall’s decision to stop providing non-pork meals was “illegal, discriminatory and a violation of the freedom of conscience and religion”.

The Dijon administrative court said it had not accepted the LDJM’s argument about religious freedoms but had considered the “greater interest of the child”. The judge pointed out that the town hall had provided alternative non-pork meals since 1984 “with no argument whatsoever”.

The French national consultative committee on human rights said the town hall’s action relied on a “erroneous intepretation of the principles of secularism and equality”.

“Secular principles come second to children’s rights,” Nicolas Gardères, LDJM’s lawyer, had argued.

Chalon-sur-Saône is not the only local authority that is a battleground over national identity and the place of Islam in French society, as the Guardian reported in October 2015.