Macedonia's former prime minister Nikola Gruevski enters a court in Skopje, Macedonia October 5, 2018. REUTERS/Ognen Teofilovski

BUDAPEST (Reuters) - A Hungarian court on Thursday refused to extradite former Macedonian prime minister Nikola Gruevski, who fled abroad last year after being sentenced to two years in prison on corruption-related charges.

National news agency MTI reported that the Budapest municipal court rejected a North Macedonian request for his extradition saying that a person who had been granted asylum cannot be sent back to the country he had escaped from.

Gruevski was released from custody on Thursday on the court’s order, MTI said.

The Hungarian Immigration and Asylum Office granted asylum to Gruevski in 2018.

Macedonian police had issued an arrest warrant for Gruevski, who resigned in 2016 after a decade in power, after he failed to show up to begin his sentence in Macedonia, as the country was known before a name change to North Macedonia this year.

Prime Minister Viktor Orban’s cabinet chief Gergely Gulyas told a news conference on Thursday that the government respected the Hungarian court’s ruling on the extradition.

Orban supported the fellow right-wing nationalist Gruevski in the run-up to Macedonia’s 2017 election and praised his party’s efforts to halt migrants passing through the Balkans to western Europe.

Orban’s office had earlier said it considered Gruevski’s asylum request to be “solely a legal issue” to be handled by the competent authority.

The ex-Yugoslav republic changed its name to North Macedonia from Macedonia this year, resolving a decades-old dispute with Greece and opening the way for EU and NATO membership. Gruevski had opposed any name change.