The Supreme Court of Appeal said while there was no evidence that the visa was denied, the Home Affairs Minister Nkosazana Dlamini-Zuma “had unreasonably delayed her decision,” adding that in doing so, she “acted unlawfully,” the AFP news agency reported.
The Tibetan spiritual leader and Nobel laureate is viewed by China as a political dissident who supports independence for Tibet while living in exile in India.
China has sought to isolate the Dalai Lama internationally, pressuring foreign governments not to meet with him or grant him entry into their countries.
The Pretoria government has not indicated whether pressure from Beijing had anything to do with the delay in granting the Dalai Lama a visa, though the court said that the foreign ministry had expressed “reservations” about the decision, citing diplomatic relations with China.
"The proposal raised serious concern that the visit by the Dalai Lama would put at risk the friendly relations between this country and the government of the People's Republic of China," wrote appeal court judge Robert Nugent, the AFP reported.
The government said it accepted the court’s decision, but would have to review details of the court’s decision before responding.
The appeal against the government action had been brought forward by two opposition parties, the Inkatha Freedom Party (IFP) and the Congress of the People (Cope).
IFP leader Mangosuthu Buthelezi said the ruling revealed that the government had lost "principles, moral direction and moral legitimacy," according to the BBC.
"We are inviting the Dalai Lama to come to South Africa as soon as it is convenient to him, and we look forward to having him in our midst again to share with him the bond of peace, love and enlightenment,” he added.