ISLAMABAD — A Pakistani court on Tuesday sentenced the country’s former military ruler Gen. Pervez Musharraf to death in a treason case related to the state of emergency he imposed in 2007 while in power, officials said.

It’s the first time in Pakistan’s history that a former army chief and ruler of the country has been sentenced to death. Musharraf, who was sentenced in absentia, has been out of the country since 2016, when he was allowed to leave on bail to seek medical treatment abroad.

He has been living in Dubai, the United Arab Emirates, and is said to be very ill and unlikely to travel home to face the sentence. Pakistan and the UAE have no extradition treaty and Emirati authorities are unlikely to arrest Musharraf. If he were to return, however, Musharraf would have the right to challenge his conviction and sentence in court.

The ruling Tuesday by a three-judge panel was not unanimous and one of the judges had opposed the death sentence, according to Akhtar Shah, one of Musharraf’s lawyers. Shah said he would appeal the sentence.

“Musharraf today sent me a message, saying he is ready to come to Pakistan but his doctors are not allowing him to travel,” the lawyer told the Associated Press following the ruling. He added that Musharraf offered to give a statement to the court through a video link but the request was denied.

A senior Supreme Court lawyer, Hamid Ali Khan, hailed the verdict as long overdue. “For the first time in the history of Pakistan … a military dictator has been punished by a court of law,” he said.

After the sentence was announced, Pakistan’s Information Minister Firdous Ashiq Awan told reporters that Prime Minister Imran Khan’s government would “review in detail” the verdict before commenting on it. Khan, who enjoys good ties with the country’s powerful military, is expected to return home from Geneva on Wednesday.

The military did not immediately react to the death sentence for Musharaf, a former army chief. Defense Minister Pervez Khattak said the ailing former dictator still has the right to appeal.

Mehrene Malik Adam, the secretary-general of Musharraf’s small opposition party All Pakistan Muslim League, denounced the trial. “Legal requirements were not met and our lawyers were not given the opportunity to present their case,” she said.

In an infamous purge in 2007, Musharraf imposed a state of emergency and placed several key judges under house arrest in the capital, Islamabad, and elsewhere in Pakistan. He came to power after ousting former Prime Minister Nawaz Sharif in a 1999 bloodless coup.

Later, when he was back in office, Sharif first accused Musharraf of treason in 2013. The general was formally charged in 2014.

Musharraf was hospitalized again last week in Dubai but the state of his health or a specific reason for this hospitalization has not been announced. Earlier, in a video message he released two weeks ago, Musharraf said he was ready to record his statement about the treason case for the court but that he was unable to travel to Pakistan.

In the video, looking visibly unwell, Musharraf claimed the treason charges were baseless and said he served his country for 10 years.

“I have fought for my country,” he says in the video. “This is a case in which I have not been heard and I have been victimized.”

Sharif himself was ousted in 2017 and was later convicted of corruption. He left Pakistan on bail earlier this month to travel to London for medical treatment.

Sharif’s spokesman Ahsan Iqbal praised Tuesday’s ruling, saying Musharraf deserved the death sentence because he had ousted an elected government. “We welcome this court ruling,” Iqbal said, adding that the judges had done justice to a former dictator.