The Irish senate will vote for emergency legislation after 120 types of drugs, including magic mushrooms, ketamine and ecstasy, were accidentally legalised on Tuesday.

The Irish Court of appeal ruled the 1977 Misuse of Drugs Act was unconstitutional after being challenged on the issue by a man prosecuted for possession of 4-methylethcathinone, also known as 4-Mec or snow blow, in 2012.

Stanislav Beredev, after denying the charges, argued that orders given by ministers to add the new drug to the list in 2011 were unsubstantial because they were made without public consultation.

The Court stated that some of the measures that were taken by the Government to prohibit drugs since the 1977 Act should have been voted on by the Irish Parliament and were, therefore, unconstitutional.

This means that, technically, the possession of many class-A drugs is legal until midnight in the country. Selling, supplying, importing and exporting any of these drugs is still illegal, and so are older substances such as heroin, cocaine and LSD.

Leo Varadkar, the Irish Minister for Health, introduced an emergency bill only hours after the ruling was made.

He said in a statement: "We had no way of knowing what the Court would decide today, but we prepared for this possibility.

"The emergency legislation I am introducing today will reinstate the status quo ante and re-control all drugs that were controlled prior to this judgment."

The law was then passed by the Irish Parliament in a rush on Tuesday night. It now still has to be passed by the Irish senate later today, then signed off by Michael Daniel Higgins, the President of Ireland.

Social media users didn't fail to react to the news by comparing the 24-hour legalisation to the American movie The Purge (2013). The horror film sees an American government overwhelmed by crime allowing any kind of criminal activity - including murder - for one night every year.

Other tweets complained about the impossibility of being in Ireland for the day or used the opportunity to relaunch the debate about decriminalisation of drugs. #Society