Two Northumbria University students almost died when they drank the equivalent of 300 cups of coffee at once during a sports experiment.
Alex Rossetto and Luke Parkin each consumed around twice a potentially fatal dose of caffeine during a practical exercise at the university in March 2015 because of a routine maths mistake.
The men, who were both 20 and in the second year of sports science studies degrees, suffered immediate "violent" side effects including dizziness, blurred vision, shaking and rapid heartbeat, after taking 100 times the amount they should have.
Both students were taken to hospital where they spent days in intensive care and were forced to undergo dialysis.
Prosecutor Adam Farrer told Newcastle Crown Court that both students had been in "potentially life threatening conditions".
Mr Farrer added: "If they had not been admitted to intensive care immediately for treatment, they could have died from caffeine overdose."
The court heard both men lost large amounts of weight as a result of what happened and their sports training regimes were affected.
The students have both been able to continue with their studies since, but suffered months of side effects from the caffeine intake.
Northumbria University, which had no proper risk assessment for the experiment in place, admitted a breaches of health and safety rules.
The court heard the university had previously used Pro Plus type tablets in the experiment, called The Wingate Test, but for the past few years had switched to using pure caffeine in powder form.
During the experiment, Mr Rossetto was given 30.7g of caffeine and Mr Parkin given 32g, which was mixed into a solution of water and orange juice, to test it's effect during exercise.
Mr Farrer added: "It was 100 times the dosage they should have been given.
"They should have been given 306 mg in the case of Mr Rossetto and 320mg in the case of Mr Parkin.
"No one, including the lab technicians or Senior lecturer, checked to ensure the dosage had been correctly calculated."
Mr Farrer said a deadly dose for Mr Rossetto would be around 15.3g and for Mr Parkin around 16.4g.
He said the average cup of coffee contains around 0.1g of caffeine.
The court heard the lecturer, who had spoken about the dangers of caffeine overdose during an earlier class that morning, had allowed students to work with technicians to calculate how much caffeine each volunteer should take, according to body mass.
The students' heights and weights were taken correctly but the court heard it was during calculations of how much caffeine should be taken per body mass kilo that a mistake with the mathematics was made, due to a decimal point being put in the wrong place.
Mr Farrer added: "The prosecution say the result of the overdoses to both students could easily have been fatal."
Mr Farrer said the technicians did not have enough "information, instruction or training" to supervise such practical experimentation on human subjects and that the overdoses were due to "mathematical and general knowledge error".
He added: "Students were entitled to put their trust in the university to ensure their safety.
"The university's failure to follow health and safety requirements was cumulative, persistent, long standing and systemic.
"In this case the degree of foreseeable risk from caffeine experimentation was very high and well known to the university.
"Despite this, there was no suitable and sufficient risk assessment, inadequate supervisor, inadequate checks and failure to follow rudimentary health and safety legislation."
Peter Smith, defending, told the court: "They are here because they care. They are the human face of the university.
"All those involved are deeply sorry and genuinely sorry for the breach in this case."
Northumbria University has been fined £400,000 and ordered to pay £26,468 costs plus a £120 victim surcharge.
Judge Edward Bindloss said the fact the students were in good physical shape probably helped their bodies cope with the enormous dose of caffeine.
Judge Bindloss said: "It was known excess caffeine was potentially fatal, it should have had high priority, risk assessments should have been carried out and appropriate checks put into place and appropriate training given. "
The judge said he was satisfied the university took the incident that "very seriously" and fully cooperated with the HSE investigation and prosecution.
The judge noted the presence of university executives in court and added: "I am fully satisfied they have acted appropriately and have shown genuine remorse for this incident."
The university has no previous convictions.
Speaking after the case the university said it was 'genuinely sorry' for what happened and have put measures in place to stop it happening again.
A spokesman added: "This was an isolated incident. We reacted promptly to what took place. This included fully co-operating with the HSE investigation and the subsequent prosecution. The University wishes to emphasise that the welfare of students and staff is paramount at all times."