JOHANNESBURG — Shielded by the authorities, President Omar Hassan al-Bashir of Sudan flew out of South Africa on Monday morning aboard his presidential jet, just hours before a South African court ruled that the government was legally required to arrest him.

Mr. Bashir’s plane left a South African military airport near Pretoria, the capital, unhindered by the South African authorities who had already been ordered over the weekend by South Africa’s High Court to prevent him from departing.

Though South Africa is a member of the International Criminal Court, its government defied the longstanding arrest warrant for Mr. Bashir, who again eluded international prosecutors seeking to try him on charges of war crimes, crimes against humanity and genocide related to the conflict in the Darfur region of Sudan.

His departure dealt a serious blow to the international court’s six-year campaign to bring him to justice. Mr. Bashir’s plane took off just as South Africa’s High Court was holding a hearing on whether the government was required to comply with the international court, which is based in The Hague.