An Australian nun ordered to leave the Philippines after angering President Rodrigo Duterte won a reprieve on Monday from imminent deportation but is still subject to proceedings to expel her.
Sister Patricia Fox, 71, was briefly detained in April after Duterte ordered her arrest, accusing her of political activism that violated the rules of her visa.
The move came as the government cracked down on foreign critics of his human rights record.
The immigration service had cancelled her visa and directed Fox to leave the Philippines by Monday, but the justice department nullified the order as having no legal basis.
"What the (immigration service) did in this case is beyond what the law provides, that is why it has to be struck down," said a statement from Justice Secretary Menardo Guevarra, who oversees immigration matters.
The decision gave Fox a reprieve but the department also ordered the immigration authorities to hear a case on her visa's cancellation along with pending deportation proceedings.
"Until a final resolution of the... proceedings is reached, or until the expiration of her missionary visa, whichever comes first, Sister Fox may continue to perform her duties as a missionary in the Philippines," the statement said.
Fox, who declared herself relieved after the decision, said her visa was valid until September 9.
"We are very pleased actually, because we weren't sure what would happen," she told AFP. "I was just so relieved."
Fox, who has been living in the Philippines since 1990, attracted Duterte's wrath after joining a fact-finding mission in April to investigate alleged abuses against farmers -- including killings and evictions by soldiers fighting guerrillas in the southern Philippines.
Duterte, 73, has also launched a deadly crackdown on drugs and has railed against human rights critics, especially foreigners whom he accuses of meddling in his nation's affairs.
In April Duterte accused Fox of "disorderly conduct".
"Don't let her in because that nun has a shameless mouth," he said then.
A missionary of the Sisters of Our Lady of Sion, Fox has denied engaging in politics, saying her actions were part of her work to advocate for justice and peace. She adds she enjoys freedom of expression.
Before Monday's decision was released Fox said she would fight moves to deport her.
"It's more of looking at getting due process for myself (and) this happening to others," she told ABS-CBN television.
"I'm thinking if there's no due process when I am high profile, how much more in the provinces where people are being arrested?"