Hungarian authorities are considering an asylum request from Nikola Gruevski, the fugitive former prime minister of Macedonia, in a case that will be closely scrutinised to see just how far the Hungarian leader, Viktor Orbán, is prepared to push his strained relations with Brussels.

Gruevski escaped from Macedonia after being sentenced to a jail term and fled to Budapest, announcing his presence in Hungary via Facebook on Tuesday.

Orbán, the rightwing prime minister who is already under fire from Brussels over rule of law and corruption concerns, has long had warm relations with Gruevski, who was forced to step down in 2016 after a wire-tapping scandal. He was sentenced to two years in prison on corruption charges earlier this year, and was due to start his sentence last week after his appeal failed.

Gergely Gulyás, chief of Orbán’s cabinet, said Gruevski had sought asylum at a Hungarian diplomatic outpost outside Macedonia but did not give further details. He said Hungarian authorities had not aided Gruevski in his flight from Macedonia. It is unclear how he managed to evade passport checks and make it into Hungary.

On Wednesday, an official from Orbán’s Fidesz party said Gruevski was “persecuted and threatened by a leftwing government, on which the influence of George Soros can be clearly shown”. Both Orbán and Gruevski have mounted campaigns against Soros, the Hungarian-born American financier and philanthropist, accusing him of interference.

The Macedonian foreign minister, Nikola Dimitrov, spoke with his Hungarian counterpart, Péter Szijjártó, by phone on Thursday morning, and told him Gruevski was “a convicted felon against whom there are several other court proceedings for serious crimes”, according to a readout released by the Macedonian side. Szijjártó confirmed that the asylum hearing process had already begun.

Dimitrov said it was “impossible to digest” that Gruevski would seek refuge in an EU country, having been accused by the European commission in 2016 of turning Macedonia into a captured state.

Nikola Gruevski, left, greets Viktor Orbán during the Hungarian prime minister’s visit to Macedonia in 2017. Photograph: Aleksandar Kovacevski/EPA

Orbán now faces a difficult decision. If Hungary grants asylum to Gruevski it is likely to cause further friction with Brussels. However, if he rejects it, he will be abandoning a political ally.

A notable irony of the situation is that Orbán’s staunchly anti-migration government has recently introduced a range of legislation penalising those who “support illegal migration”. It has built a fence along its southern border, has said anyone claiming asylum must wait in a guarded transit zone while doing so, and has also said anyone arriving from a designated safe country is not eligible to claim asylum.

The opposition MP Ákos Hadházy wrote on Facebook on Thursday that he would report the government to the police for supporting illegal migration in the case of Gruevski.

Gulyás said Gruevski had been allowed to remain in Budapest due to security threats, and added that he would not be able to leave Hungary while the asylum process was ongoing. He said Orbán and Gruevski had not met since the Macedonian had arrived in Hungary, and said Orbán was “very amused” by reports that Gruevski was living at his house.