The American rapper known as Mos Def will be allowed to leave South Africa after he apologised for breaking immigration laws.

The rapper — whose real name is Yasiin Bey — was arrested in January after trying to leave South Africa on a "World Government of World Citizens" passport, which South Africa does not recognise as a legal travel document.

Def, who has lived in Cape Town since 2013, will be declared an undesirable person for his actions and will not be granted re-entry to South Africa, the Home Affairs Department said.

"[He] has unreservedly apologised to the Government of South Africa," it said in a statement.

"The department is satisfied with the apology [and] will withdraw the charges against him."

The World Passport is a document issued by a non-profit organisation called World Service Authority (WSA), set up in the United States after World War II to advocate for world citizenship.

Citing the United Nations' right to freedom of movement, it has been issuing World Passports since 1954.

Many countries do not accept the passport either as a travel document or a formal identity, but WSA claims countries such as Togo, Mauritania, Ecuador, Zambia and Tanzania have accepted the 30-page document in the past.

Reuters