Mrs May ignored a legal agreement to release an Algerian robber from immigration detention in a decision that lawyers say risked throwing the whole system into confusion.
As a result, Judge Barry Cotter, QC, made the extremely rare ruling that the Home Secretary was in contempt of court.
He said there has been the "most regrettable and unacceptable behaviour" of the Secretary of State leading to an "intentional breach" of her previous undertaking to free the foreign criminal, Aziz Lamari.
The judge said he recognised the seriousness of her failure to obey the deal, and said that a clear message must be sent that it must not happen again.
However because the Home Secretary eventually released the prisoner, she escaped sanctions which could have included a fine or even imprisonment.
A spokesperson for the Judicial Office said: "HHJ Cotter QC found the defendant guilty of contempt for failing to release Aziz Lamari having undertaken to do so.
"There was no penalty imposed for the contempt - the finding in itself is serious."
It is only the second time in British legal history that a Home Secretary has been found guilty of contempt of court.
On the first occasion, in 1991, Kenneth Baker ignored an instruction from a judge in an asylum case and the ruling against him was backed up by five law lords in a landmark judgment.
A spokesman for Duncan Lewis, the solicitors who brought the new case, said they believed Mrs May's tough talk on immigration had led UK Border Agency officials to ignore the order to release Lamari.
He said: "It is regrettable that the Secretary of State's officials decided to refuse to honour their own undertaking. We note from their own evidence that this decision was taken after 'senior UKBA personnel were consulted'. We firmly support the decision of the judge. Undertakings are a vital part of the machinery of litigation and save all parties and the Court from the need to exhaustively litigate every last issue. We believe that the finding that the refusal to honour the undertaking was Contempt of Court was in part designed to ensure that there is no future repetition of this conduct on their part.
"We also consider it likely that the Home Secretary's intemperate comments about the Human Rights Act and the perceived failings of the judiciary gave rise to a culture within UKBA in which her officials failed to abide by the rule of law. The instant case is only one, albeit the most serious, example of this behaviour on their part. We consider that they are likely to take their lead from the minister and be influenced by her stance in these matters."
A UK Border Agency spokesman said: "Aziz Lamari is a failed asylum seeker who had served custodial sentences for serious offences. He was held in immigration detention awaiting removal to Algeria and we accept that he was not released on the date set by the court, which resulted in yesterday's judgment.
"We are reviewing how this happened urgently."
Lamari, 22, arrived in Britain in 2009 and applied for asylum but absconded three times three times over the next few months and was convicted of exposure and then robbery.
His 12-month sentence ended in December 2010 but he remained in immigration detention while attempts were made to return him to his native Algeria, during which time he made several suicide attempts.
Following a court hearing on May 25th, the Home Secretary and her officials agreed with his legal team that he should be released by June 8th.
But by June 12th he was still in detention and the Government tried to get out of the earlier undertaking.
He was not released until late on June 14th and Judge Cotter, sitting at Exeter Crown Court this week, ruled that Lamari was entitled to damages because he was detained too long and should have been allowed out by May 23rd at the latest.
His solicitors also made an application for committal of the Home Secretary for breaching her undertaking, which led to the judge finding her guilty of contempt of court.