Six suspects were subsequently arrested over the attack and related alleged violence at the cour.
Otafiire who was speaking to journalists on Tuesday at the Uganda Media Centre described the attack as "barbaric" and "regrettable".
"The ministry of justice and constitutional affairs condemns in the strongest terms possible, the ugly occurrences that braced the court, of an attack on a judicial officer, while in course of her duties. Such acts are barbaric, regrettable and should have no place in the modern and democratic Uganda today or in the future. These are reminiscent of dark ages," he said.
Last week on Friday, Kamasanyu had a water bottle thrown at her as she read Dr Stella Nyanzi’s sentence over cyber harassment-related offences.
Six suspects were subsequently arrested over the attack and related alleged violence at the courtroom.
The suspects Simon Wanyera, Abdullah Waiswa, Augustine Ojobile, Joel Kabali, Fatuma Abenabyo and Moses Katumba were on Monday charged with three counts of inciting violence, assault and contempt of court.
"Acts of violence such as that we saw in the court last week, through the noise made during the court session and pelting of a bottle at the Magistrate should not be tolerated anywhere near our temples of justice," Otafiire said.
Several judicial officers, including the Chief Justice, Bart Katureebe, and the Uganda Law Society (ULS) have also condemned the attack on Kamasanyu and subsequent events in the courtroom.