Wikileaks founder Julian Assange has lost one legal bid to have a UK arrest warrant against him quashed but immediately launched another, to have the British authorities halt any action against him on public interest grounds.
Judge Emma Arbuthnot said she would give her decision on February 13.
A ruling in Mr Assange's favour could pave the way for him to leave the Ecuadorean embassy in London where he has been holed up for more than five years.
Mr Assange, 46, entered the embassy in an apartment in the wealthy district of Knightsbridge to avoid extradition to Sweden to face an allegation of rape, which he denied.
The Swedish case has since been dropped, but Assange was still subject to the British warrant for breaching his bail conditions in 2012.
He has said he feared Sweden would hand him over to the United States to face prosecution over Wikileaks' publication of leaked US military and diplomatic documents.
Had the judge ruled in Mr Assange's favour, he would have been free to leave the embassy without being arrested on the British warrant.
Judge Arbuthnot had earlier rejected a legal argument to have the arrest warrant against him quashed on the basis that with the Swedish case dropped there was no longer any justification for it.
"I am not persuaded that the warrant should be withdrawn," Judge Arbuthnot, the chief magistrate of England and Wales, said during the hearing at Westminster Magistrates Court.
Mr Assange's lawyer Mark Summers then launched a separate argument that even if his client was arrested and brought to court, it would not be in the interests of justice to take any further action.
He said Assange had "reasonable grounds" for fleeing to the embassy in 2012 because of his fear that he would ultimately be extradited to the United States.
A United Nations working group has ruled his present situation is "arbitrary, unreasonable, unnecessary and disproportionate," Mr Summers noted.
"The last five-and-a-half years he has spent might be thought adequate, if not severe punishment for the actions he took," he added.
Assange's mental, physical health deteriorating
Mr Assange's supporters say his health has deteriorated significantly during his years in the embassy, and the London court heard he had suffered depression, dental and shoulder problems.
"His health issues are not that bad," Judge Arbuthnot said.
However, should she rule in Mr Assange's favour next Tuesday, it remains unlikely that he will leave the embassy immediately.
That is because he fears that with the Swedish issue out of the way, the United States will unseal charges against him and that the British authorities would arrest him under a US extradition warrant.
His supporters hope that a court victory will force the British authorities to disclose whether such a warrant has been issued by the US authorities.
His lawyer Jennifer Robinson said in a statement: "We must confront the real issue in this case — if Julian Assange walks out of the embassy today, he risks facing extradition to the US to face prosecution for publishing information in the public interest with Wikileaks."
"Mr Assange remains ready to face British justice … but not at the risk of being forced to face American injustice..." she said.
Earlier this month, Ecuador said it had granted the Australian-born hacker citizenship, as the South American country tried to unblock the stalemate that has kept Mr Assange as its houseguest for five-and-a-half years.
Ecuador also asked Britain to grant him diplomatic status. Britain refused, saying "the way to resolve this issue is for Julian Assange to leave the embassy to face justice."