The US has accused South Africa's defence ministry of refusing to obey orders from its own government to send home Iranian warships that have been conducting naval exercises in the African country's waters.

South Africa can't lecture the world on 'justice' while cozying up to Iran, it said in a statement.

In response, South Africa's defence ministry said it was launching an inquiry to get to the root of these serious allegations.

Washington has criticized South Africa for inviting Iran at a time when a brutal crackdown against protests was happening in the Middle Eastern country.

It said the South African military's actions did not amount to non-alignment but were instead a choice to stand with Iran.

This is absolutely no surprise. Protests against the Iranian regime are happening right now, human rights organisations here in SA have been calling for support for the protesters, William Gumede, an associate professor at the University of Witwatersrand, told the BBC.

These are all democratic violations and human rights abuses and we have not heard a whimper from the ANC. That is the irony and hypocrisy, it's been criticising other regimes but it's been silent on what's happening in Iran.

In the strongly worded statement posted on its social media accounts, the US embassy in South Africa noted with concern and alarm reports that the country's defence minister and its defence forces had defied government orders to ask Iran to leave.

The embassy stated Iran's participation undermined maritime security and regional stability and was unconscionable as it suppressed protests back home, comparing them to peaceful political activity South Africans fought so hard to gain for themselves.

The office of Defence Minister Angie Motshekga said she would like to place it on record that President Cyril Ramaphosa's instructions had been clearly communicated to all parties concerned, agreed upon and to be implemented and adhered to as such.

Dubbed Peace Resolve, the week-long naval drill got under way last Friday. It is being led by China - and involves other members from an alliance of major developing countries, including Russia.

The alliance, established in 2006 as BRIC with Brazil, Russia, India, and China, expanded to BRICS with South Africa. Its recent members include Egypt, Ethiopia, Indonesia, Iran, and the UAE, aiming to challenge the political and economic power of wealthier Western nations.

Iranian warships had already arrived in Cape Town when the order to turn them around reportedly came through.