In a landmark ruling, the province of Ontario’s top court legalized brothels and will allow prostitutes to have security staff to protect them.

Ontario's top court has legalized brothels in the Canadian province, a ruling that is meant to protect the safety of sex workers.

The landmark decision taken Monday, decided that the dangerous work of prostitution could be made more safe if it occurred under one roof with security staff, reported the Globe and Mail.

The Appeals Court of Ontario said that some of the country's anti-prostitution laws were unconstitutional as they restricted the prostitute's ability to protect themselves - a ruling already made by a lower court in 2010 but appealed by the provincial and federal governments.

The court also said that it would re-model the law against pimps, which prohibits living off the work of others by adding "in circumstances of exploitation," reported PostMedia News.

This is thought to allow violent or manipulative pimps to be arrested, while permitting prostitutes to be able to hire drivers and security staff for their safety.

Prostitution is legal in Canada with many caveats.

According to the Associated Press, while sex work might be legal, soliciting sex and operating a brothel are both criminal acts.

While the latter provision was struck down, the court upheld the ban on soliciting sex in public.

According to the National Post, the new laws will likely prompt similar challenges in other provinces around the country.

The case was brought forward by an appeal by the provincial and federal governments, which opposed the earlier lower court ruling.

The case took nine months of deliberation and a week of oral arguments with more than 25,000 pages of evidence, according to the National Post.

Witnesses at the hearings included current and former prostitutes, police, activists, politicians and journalists.

Both sides said they will take their case to the Supreme Court of Canada if they lost.

The new laws, which will be binding in Ontario, will come into effect next year.