A Canadian judge upheld an eviction order for protesters camped in downtown Toronto on Monday, giving the Occupy Toronto movement until midnight to vacate the park they've held for more than a month.

Ontario Superior Court Judge David Brown ruled the eviction order - issued by the city last Tuesday and challenged in court by the protesters - did not violate the demonstrators' freedom of expression and peaceful assembly.

Protesters first set up shop in Toronto's St. James Park on October 15, following the lead of Occupy Wall Street protesters in New York's Zuccotti Park.

The Zuccotti Park protesters were forcibly evicted last week and it was unclear whether their Toronto compatriots would suffer the same fate.

The court ruling upheld city of Toronto bylaws prohibiting tents and shelters in parks and stating that parks must be vacated between midnight and 5:30 a.m.

In his written decision, Brown said the protesters' decision to take over the park without first consulting local residents was not in line with protections under Canada's Charter of Rights and Freedoms.

The protesters now say, in effect, that the charter did not require them to ask; that the charter sanctions their unilateral occupation of the park, he wrote.

With the greatest of respect to the applicants and the protesters, they are mistaken.

In a press conference shortly after the decision, Toronto Mayor Rob Ford said he had asked protesters to leave the park peacefully and as soon as possible.