Rapper and outspoken activist Mos Def was arrested at a South African airport on Thursday for allegedly violating local immigration laws while trying to leave the country.

Mos Def, who now goes by the name Yasiin Bey, appeared in a South African court after his arrest at Cape Town International airport, the AP reported.

The rapper, 42, allegedly produced an unrecognized "world passport" when he tried to leave South Africa, the nation's Department of Home Affairs spokesman Mayihlome Tshwete told the AP.

"A court order to leave the country means the rapper is banned from South Africa for five years, but may appeal to officials for leniency, Tshwete said. Mos Def appeared alongside family members who were also in the country without a permit, the spokesman said," the AP reported.

Mos Def has reportedly lived in Cape Town since May 2013.