Peru's top court has ruled that workers cannot be fired for being drunk on the job, a decision the government criticized on Wednesday for setting a dangerous precedent.

The Constitutional Tribunal ordered that Pablo Cayo Mendoza be given his job back as a janitor for the municipality of Chorrillos, which fired him for being intoxicated at work.

The firing was excessive because even though Cayo was drunk, he could still speak and write, and he did not hurt anybody, Justice Fernando Calle said.

Calle said the court would not revise its decision, despite complaints from the labor ministry.

Celso Becerra, the administrative chief of Chorrillos, a suburb of Lima, denounced the ruling.

"We've fired four workers for showing up drunk, and two of them were drivers," he said. "How can we allow a drunk to work who might run somebody over?"