Bahraini judicial authorities on Wednesday nullified the convictions and harsh prison terms given to 20 medical workers last week by a special security court prosecuting cases arising from civil unrest in the country. The medical workers were ordered released from custody, with new trials scheduled in a civilian court.

The decision appeared to be at least a tactical retreat by Bahrain’s Sunni monarchy in the face of strong international protests over the punishments, including criticism from the secretary general of the United Nations, Ban Ki-moon. The special court had sentenced some doctors and nurses among the defendants to terms as long as 15 years because they had treated demonstrators who were wounded by security forces. Most of the protesters are members of the Shiite majority in the tiny Persian Gulf country.

Bahrain’s attorney general, Ali Alboainain, said in a statement carried by the official Bahrain News Agency that he had studied the judgment that the security court rendered Thursday and had “determined that the cases should be retried before the ordinary courts.”

Citing his department’s authority to ensure “rightful application of the law,” Mr. Alboainain said: “No doctors or other medical personnel may be punished by reason of the fulfillment of their humanitarian duties or their political views. Pending the outcome of the retrials, the accused shall not be detained.”