MADRID — A judge has intervened in a fierce political battle over who should be allowed to drive in Madrid, ordering the city’s new right-wing administration to continue fining people who take polluting vehicles into a restricted central zone.

Mayor José Luis Martínez-Almeida had prompted street protests by suspending fines against those who drive older cars or motorcycles into Madrid Central, a low-emissions zone established by his left-wing predecessor. The mayor’s team said the moratorium on fines would last three months while it studied other ways to combine car traffic with efforts to improve air quality.

But in a local court ruling issued on Friday, less than a week after the fines stopped, Judge Jesús Torres Martínez ruled that the Madrid Central system was “essential” in order “to improve the quality of the air that the citizens of Madrid breathe, which has a direct impact on health.”

Madrid’s City Hall said that it would respect the order to reinstate the fines for now, but planned to appeal the judge’s ruling, which came after several lawsuits were filed against the suspension of Madrid Central. The Socialists, which form part of the opposition in Madrid, joined Greenpeace and other environmental groups in taking the new mayor’s team to court.