FILE PHOTO: South Africa's opposition Democratic Alliance (DA) leader Mmusi Maimane listens in Parliament in Cape Town during a motion to impeach President Jacob Zuma, April 5, 2016. REUTERS/Mike Hutchings/File Photo

JOHANNESBURG (Reuters) - South African opposition leader Mmusi Maimane said Zambian immigration officials barred him from entering their country late on Thursday, stopping his visit to a detained opposition leader there.

Maimane of South Africa’s Democratic Alliance said on Twitter the officials boarded his plane after it landed, “took away my phone so I couldn’t get help” then forced him to return home.

Zambia’s immigration police and government were not immediately available for comment.

Maimane said he was planning to visit Hakainde Hichilema, the leader of Zambia’s United Party for National Development (UPND), who was arrested in April and charged with trying to overthrow the government.

A Zambian judge was due to rule on Friday whether Hichilema should go on for trail.

Zambia was seen as one of southern Africa’s most stable countries until relations soured between the government and opposition in August, when President Edgar Lungu’s Patriotic Front (PF) party beat the UPND in elections marred by violence.

The opposition says the vote was rigged but Hichilema has so far failed in his legal challenge against the result. They also say the charges against him are politically motivated.

Zambia’s ruling PF party had warned Maimane against his visit.

“It is common knowledge that there is an explicit court order detailing who can visit the incarcerated Opposition leader and it would be rather unfortunate for Maimane to violate the prescripts of this order which will find him in conflict with the laws of our land,” the PF said in a statement before he arrived.