The provincial Court of Appeal reversed the decision of a lower tribunal in the case of Saguenay, Que. It overturned the prayer ban in a decision made public Monday, saying that reciting a prayer does not violate the religious neutrality of the city.
"This case raises the difficult and delicate issue of the state's religious neutrality," the verdict said. "This concept combined elements of sociology, philosophy and law, requiring us to reconcile fundamental values of our democracy."
Quebec's human-rights tribunal had issued a ruling in 2011 ordering a stop to the prayers. It also insisted that the crucifix in the city council chamber be removed and that damages be paid to a resident who had complained.
The mayor of Saguenay, Jean Tremblay, fought that ruling in court and raised money from religion supporters for his case through a website and a toll-free number.
During that time, the prayers had been replaced by two minutes of silence.
The original prayer itself was non-denominational, making reference to an unspecified God and asking for his guidance and wisdom. The court expressed reservations, however, that there were Christian religious symbols inside the council chamber.
The verdict concluded that the city imposed no religious views on its citizens. It said the prayers had no discernible effect on the day-to-day running of the city.
"There are no specific orders related to this ceremony," the ruling said. "All throughout it, and for the entire duration of council meetings, the doors remain open and citizens can enter and leave at will."
Prayer opponents had argued that agnostic and atheist residents were forced to participate in religious ceremonies they disagreed with.
The court ruled that Alain Simoneau, the man who brought the case to court with the help of a secular-rights organization, did not demonstrate that he was discriminated against.
Meanwhile, the verdict also condemned the attitude of the city's colourful mayor for letting the matter get to court.
The case has been one of many in recent years on emotionally charged identity issues in Quebec. The mayor angrily intervened in the recent provincial election to denounce a candidate who had suggested the crucifix should come down at the provincial legislature.
Tremblay was quoted in the verdict telling media that he was fighting this battle because he loved Christ, and following his death wanted to be able to tell him: "I fought for you."
The verdict said Tremblay's comments and behaviour "demonstrated a lack of basic discretion for someone holding elected office."