Mos Def, the 42-year-old hip hop artist, actor and activist

American rapper Mos Def will be tried in a South African court in March after being arrested for presenting a "world passport" when trying to fly out of the country, officials said Wednesday.

The 42-year-old hip hop artist, actor and activist, whose real name is Dante Terrel Smith, was arrested in Cape Town last week while attempting to board a flight to Ethiopia.

He was later released on bail of 5,000 rand (about $300).

The Department of Home Affairs said the actor had entered South Africa with a legitimate US passport in November, and had a visitor's visa valid until February.

"The major problem why he could not get on the Ethiopian flight was the document he produced at the immigration counter, the World Passport, which South Africa does not recognise," home affairs director general Mkuseli Apleni told reporters.

"Immigration officers had also detected that his spouse and minor child had overstayed their visit to the Republic.

"Mister Smith will appear for trial on March 8 to answer the immigration charges."

Smith attempted to leave the country using a "World Government of World Citizens" passport, Apleni said.

The World Government of World Citizens was established in 1953 by the late peace activist Garry Davis, an American who renounced his citizenship after World War II.

Both WikiLeaks founder Julian Assange and intelligence leaker Edward Snowden are reported to be holders of world passports, which are not officially recognised.

Mos Def, who also uses the name Yassin Bey, faces charges including using a false identity, and "aiding and abetting his family to stay illegally in South Africa".

His family's visas expired in April 2014, and they have been given until January 29 to leave South Africa.

According to immigration officials, Mos Def entered the country ten times since 2013, always on a 90-day tourist visa using a US passport.

He is believed to have been living in Cape Town for some years.

"I haven't broken any law. And I'm being treated like a criminal," he said on a message released via superstar rapper Kanye West's Twitter feed. 

In 2014, Mos Def cancelled a planned tour of the US due to what his publicists called "legal and immigration issues".

In his acclaimed hip-hop career he has produced classic solo songs as well as albums with Talib Kweli in the duo Black Star.