South Africa says it will consider withdrawing from the International Criminal Court as a "last resort" following a dispute over Sudanese President Omar al-Bashir, who visited South Africa this month despite an international order for his arrest for alleged war crimes.

The South African government said in a statement Thursday that the Cabinet is reviewing the country's status as a signatory to the statute that set up the international court. The statement says South Africa would have found it difficult to arrest al-Bashir because of treaty obligations to the African Union. Al-Bashir was in South Africa for an AU summit in Johannesburg.

Some African leaders say the International Criminal Court has unfairly targeted African heads of state. The African Union said delegates to the summit in Johannesburg had immunity.