Bailiff, get the yayo.

A Mexican judge has granted two people the right to “possess, transport and use” cocaine — recreationally — in what’s being praised as a “historic” first step toward ending the country’s “war on drugs.”

“We have spent years working for a more secure, just and peaceful Mexico,” said Lisa Sanchez, director of the Mexico United Against Crime group, in a press release Tuesday.

“This case is about insisting on the need to stop criminalizing … drug users and designing better public policies that explore all the available options,” she added.

Mexico’s national health regulatory agency — the Federal Commission for the Protection against Sanitary Risk — says it will attempt to block the judge’s order, which was handed down earlier this year and first announced Tuesday.

Under the new ruling, commission officials will be required to authorize the two petitioners’ use of cocaine — allowing them to snort, smoke or shoot it recreationally, but not sell it.

A panel of judges has been assigned to review the ruling and decide whether it should be carried out.

“This case represents another step in the fight to construct alternative drug policies that allow (Mexico) to redirect its security efforts and better address public health,” said anti-crime group officials.

With Post wires