Senior Counsel Ahmednassir Abdullahi risks being punished in future if he does not stop attacking the Supreme Court.
In a ruling on Friday, judges of the top court warned that such attacks shall occasion contempt of court proceedings, "with the inevitable consequences".
They added that appropriate sanctions for contempt in the face of the court will also be considered.
In the ruling read by Justice Jacton Ojwang', the court said Mr Abdullahi was more than discourteous towards the court and demonstrated willful disrespect for the authority of the court.
They said the senior counsel conducted himself in a manner calculated to lower the dignity of the court. "This was the typical instance of a trespass well outside the bounds of legitimate advocacy," Justice Ojwang' said.
While arguing for the release of two Iranians arrested with explosives in Mombasa in 2012, Mr Abdullahi accused the court of acting as surrogates of the state to legitimise the illegal and unlawful detention of the two.
The lawyer accused the court of exercising illegitimate political power without any lawful jurisdiction over the Iranians. He accused the judges of bias against the Iranians, lacking of impartiality and independence.
Mr Abdullahi said the court had previously based its decision on extraneous political factors and considerations that are underpinned by a nationalistic affinity between the court and the State.
"This court is a jurisprudential train wreck!!! It is incoherent. It is unpersuasive. It is unfaithful to the Constitution and is churning out constitutional interpretations that are at best, counterfeit," he said.
According to the lawyer, the court acts on whims and is incapable of doing justice as they expected. He said the court sometimes "appears jurisprudentially like a headless chicken".
"My Lords because you change so many times, you bend with every breeze when it comes to interpretation," he said.
When asked by Justice Njoki Ndungu to apologise and withdraw the offending paragraphs, Mr Abdullahi said, "I have explained. I have no apologies. There is nothing contemptuous [in any] of those paragraphs."
The court said the mode of address was deliberately chosen, and even though studiously insolent and impertinent, "condescending and offensive".
They said such a mode of advocacy, as they perceived it, was not only careless, thoughtless and improper, but is imprudent, and clearly intended to cast aspersions at the court.
They added that the remarks were meant to taint the credibility of the court as a core institution of the constitutional order.
The court allowed an appeal by Director of Public Prosecutions Noordin Haji and sent back Ahmad Abolfathi Mohammed and Sayed Mansour Mousavi to Kamiti, where they will complete their 15-year sentence.
The duo had been freed in January last year following a second appeal but the DPP appealed.