Photo/Illutration A Taiwanese man, right, responds to questions at a March 22 news conference along with his male Japanese partner. (Takuya Kitazawa)

In an unprecedented step, the Justice Ministry overturned a deportation order for a gay Taiwanese man who had lived in Japan illegally for more than two decades, apparently in light of his long relationship with his Japanese partner.

It decided March 22 to grant the man in his 40s a special permit to remain in Japan.

The man had initiated court proceedings to seek a retraction of the deportation order on grounds it was discriminatory, arguing that heterosexual foreign overstayers with a Japanese spouse had been allowed to remain in Japan.

Lawyers for the Taiwanese man said this was the first case of a foreign national who had a same-sex Japanese partner being allowed to remain on a special residence permit.

The Taiwanese man arrived in Japan in 1994 on a short-stay visa good only for three months. He began living with his Japanese partner soon after and they have continued to live together after the visa expired.

The Taiwanese man was arrested as an overstayer in 2016 and the Justice Ministry issued the deportation order.

A Justice Ministry official said the decision was based on "a comprehensive assessment of the circumstances surrounding the man's residence in Japan and the manner in which he conducted his daily life."

The official said the decision did not specifically emphasize his relationship with the Japanese man.