Mmusi Maimane, South Africa's main opposition leader, has accused Zambian officials of denying him entry to their country as he tried to show support for an imprisoned Zambian opposition leader who is being held on treason charges.

Maimane, of the Democratic Alliance party, planned to attend the trial of Hakainde Hichilema, the leader of Zambia's United Party for National Development (UPND), on Friday.

But Zambian officials boarded his plane on arrival in Zambia's capital, Lusaka, and prevented him from leaving the aircraft.

"[The Zambian government sent an] arrest team ... to meet me at the airport. Assaulted me & took away my phone so I couldn't get help," Maimane said on Twitter late on Thursday.

Maimane, who returned to South Africa after the failed attempt, told local media that the incident was "madness" and he had been subjected to "apartheid-era" treatment.

The rest of the arrest team that the Zambian gov sent to meet me at the airport. Assaulted me & took away my phone so I couldn't get help pic.twitter.com/cdhtO1HY85 — Mmusi Maimane (@MmusiMaimane) May 25, 2017

Zambia's ruling Patriotic Front (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.

A Zambian court on Friday is expected to rule on whether to dismiss the treason charges against Hichilema, who was arrested in April after his motorcade allegedly blocked President Edgar Lungu's convoy on a road.

Hichilema was accused of endangering Lungu's life and charged with treason, a crime for which the maximum penalty is death. He been held without bail as treason is a non-bailable offence in Zambia.

READ MORE: Zambia denies opposition leader barred access to lawyer

Maimane has called on the Zambian government to drop the charges against Hichilema.

"Mr Maimane had strongly denounced the trumped up charges against Hichilema, and had condemned the [South Africa's ruling] ANC government for not yet taking a stand against his treason charges," the DA said.

Al Jazeera's Fahmida Miller, reporting from Lusaka, said Thursday's incident has added another level of controversy to the case.

"Critics are saying that this is just another show of what seems to be an authoritarian style of governance in Zambia and they are also concerned about the independence of the courts and what may transpire on Friday," Miller said.

OPINION: Zambia: Democratic victory or vote snatching?

Hichilema's case has stoked political tensions after the most recent contested elections.

Zambia was seen as one of southern Africa's most stable countries until relations soured between the government and opposition in August, when Lungu's PF party narrowly beat the UPND in elections marred by violence.

The opposition says the vote was rigged, but Hichilema has so far failed to successfully challenge the legality of the result.