An Afghan refugee who accessed child pornography from a public library remains in legal limbo, says a Victorian judge who is finding his case "one of the most difficult" she has had to pass sentence on.

Ali Jafarri, already a convicted sex offender, pleaded guilty in the Victorian County Court to one federal charge of accessing child pornography material using a carriage service.

The charge related to the 36-year-old viewing 27 images and videos of teenage boys and girls on his laptop at the St Kilda Public Library.

The offences occurred between July 2012 and May this year, ending when Jaffari was arrested by detectives.

Jafarri had his permanent protection visa cancelled by Scott Morrison in May this year, after being previously convicted of sex crimes.

He has been in immigration detention ever since, however his lawyer told the court on Friday that he could not be deported back to Afghanistan because he still had refugee status.

The child pornography offence would usually attract a community corrections order, but Judge Jane Patrick said that was not an option because he was unable to be released from immigration detention.

But Judge Patrick said as long as Jaffari was not capable of being deported back to Afghanistan, he faced a future of indefinite detention, leaving her with no real sentencing options.

"We're in a chicken and egg situation," she said.

"I couldn't invite Mr Morrison to come here and have a discussion on this I suppose?"

"This is one of the most difficult situations as a sentencing judge I have faced."

Judge Patrick has asked the parties to clarify the situation with the Federal Government.

Ali Jafarri: Previous offences

The court heard Jaffari chose the library because he did not have an internet connection at his home and wanted to use the free wi-fi.

Jaffari has previously been convicted of six counts of an indecent act with a child.

Those offences occurred after Jaffari was released into the Geelong community on a protection visa, after stints in immigration detention at Christmas Island, Curtin in the Kimberley, and Perth.

The court heard Jaffari was living in share accommodation at the time and committed the offences at the East Geelong public pool.

He was convicted and placed on the sex offenders register for 15 years but avoided a prison term, instead being placed on a community order.

But he was unable to complete the order, because the Minister for the Department of Immigration Scott Morrison cancelled his protection visa in May.

Since then, Jaffari has been held in the Maribyrnong Detention Centre in Melbourne.

Deportation not an option: lawyer

At his plea hearing for the child pornography offence on Friday, Judge Jane Patrick said that Jaffari’s latest offence would not usually attract a prison sentence.

But Jaffari’s lawyer, John Kelly, said that his client was effectively being "warehoused" in detention.

"The Minister has found he's failed the character test," Mr Kelly said.

"That makes carrying out an obligation to a community corrections order almost impossible.

"His liberty is utterly curtailed... he has no freedom of movement over and above what somebody in custody would have."

Mr Kelly said Jaffari was escorted to court surrounded by minders and held in the court's cells like a prisoner would be.

"From his perspective there's no difference ... he's not free to come and go in the community," he said.

The court heard Jaffari came from the Ghazni Province in Afghanistan and came from the persecuted Hazara minority.

His father was shot dead in 2003 and the family fled to Pakistan, before Jaffari came to Australia in 2010.

Mr Kelly said his client came from "an impoverished rural outpost" and had received no education.

"This is simple, unsophisticated offending," Mr Kelly said.

"He finds it hard to understand how this material (child pornography) can be so readily available and at the same time constitute a crime."

"Doubtless there are cultural issues at play here."

Judge Patrick said Jaffari posed a significant risk of re-offending.

"It appears he has a significant lack of insight," she said.

"The protection of the community relies on Mr Jaffari understanding he cannot do this. I include community, wherever that is."

Jaffari will be sentenced in December.