UN rights chief Navi Pillay said Thursday Morocco has improved its human rights record but must still work hard to shake off "old habits," such as torture.
Pillay, the first UN High Commissioner for Human Rights to visit Morocco in 13 years, addressed a news conference in Rabat at the end of a four-day visit.
She said Morocco had made "great strides toward the better promotion and protection of human rights," including the adoption of a new constitution in 2011.
But she said key reforms introduced in the new charter have yet to be put into practice, such as legislation to enforce rights.
UN delegations that have visited Morocco in past years have "expressed concern over the use of torture and ill-treatment as well as the admissibility in court of confessions obtained under torture or other ill-treatment," said Pillay.
But she said King Mohamed VI told her "he will not tolerate torture, although he could not rule out that there are isolated cases."
"The litmus test of such commitments is accountability. Impunity is the most powerful fuel for human rights violations," she said.
Pillay also offered UN technical assistance for promoting human rights in the disputed Western Sahara, a former Spanish colony annexed by Morocco in the 1970s.
Morocco has come under fire from rights organisations over its record in the 90 percent of the territory it controls.
Rabat has proposed wide autonomy for Western Sahara. This is rejected the Polisario Front, which has campaigned for independence since 1973 and insists on the right of the Sahrawi people to determine their own future.
Pillay also pleaded for greater freedom of expression in Morocco, where she said "journalists and bloggers are targeted and subject to fines, withdrawal of registration and even imprisonment on allegedly trumped up charges for airing sensitive issues."
She cited the case of journalist Ali Anouzla, who was arrested last September and is on trial on charges of aiding "terrorism," saying his case reflects "the overly broad anti-terrorism legislation to penalise free expression".
Government spokesman Mustapha Khalfi later said Morocco was willing to try to "solve the problems" raised by Pillay.