The suspected Stockholm truck attacker Rakhmat Akilov, a 39-year-old Uzbek, has admitted committing a "terrorist crime" by ploughing into pedestrians on a busy street, killing four people and injuring 15 others.

Arrested only hours after Friday's attack, Akilov appeared on Tuesday in a special heavily guarded high-security courtroom wearing a thick green hoodie and keeping his head bowed.

"Akilov confesses to a terrorist crime and accepts his custody detention," said Johan Eriksson, his state appointed lawyer, at a custody hearing in Stockholm.

Judge Malou Lindblom ordered Akilov to remove the hoodie and he complied, revealing dark hair with streaks of grey.

Akilov, a Russian speaker, had an interpreter to help him follow the proceedings without addressing the court directly.

After Eriksson's statement, the judge agreed to the prosecution's request to have the rest of the hearing held behind closed doors due to the classified nature of information in the investigation.

After about an hour, journalists were admitted again to the courtroom and the judge remanded Akilov in custody.

Eriksson said that the court had ordered Akilov to undergo a psychiatric evaluation as a standard procedure, and that a confession alone would not lead to a conviction.

"A confession is not enough to be convicted of a crime, other evidence is needed to back this up," the deputy chief prosecutor Hans Ihrman said at the courthouse.

Court documents seen by AFP news agency showed that Akilov, who is facing a lengthy prison sentence, had requested that Eriksson be replaced by a Sunni Muslim, saying "only a lawyer of this faith could assert his interests in the best way". The court refused the request.

'Order against infidels'

Akilov, a construction worker who was refused permanent residency in Sweden in June 2016, went underground last year after receiving a deportation order, police said.

Friday's attack resembled previous rampages using vehicles in Nice, Berlin and London, which were all claimed by the Islamic State of Iraq and the Levant (ISIL) group.

ISIL, also known as ISIS, has not claimed responsibility for the Stockholm attack, but Swedish media reports on Monday said Akilov had told investigators that he received an "order" from ISIL to carry out the attack against "infidels".

Swedish police have confirmed that he had expressed "sympathies for extremist groups, including ISIL," but disclosed no other details.

The Aftonbladet newspaper reported that Akilov told investigators he was "pleased with what he had done".

"I mowed down the infidels," Aftonbladet quoted him as saying, citing sources close to the investigation and describing him as a father of four whose family had stayed behind in Uzbekistan.

"The bombings in Syria have to end," he was quoted as saying.

Ihrman, the deputy chief prosecutor, refused to comment on the suspect's motive, while lawyer Eriksson would only say that his client had told police why he committed the attack.

The investigative news magazine Expo, which specialises in monitoring far-right activity, said Akilov's Facebook account before it was taken down on Friday reflected a "contradictory image".

It said Akilov had "liked" Buddhist and Mormon websites, and supported both Russian opposition politician Alexei Navalny and Prime Minister Dmitri Medvedev.

In March 2016, he posted a video condemning "Islamist terror", but shared ISIL propaganda films and repeatedly expressed support for the Hizb ut-Tahrir group, which is outlawed in Russia and ex-Soviet Central Asian states.

The group, which claims to be non-violent and says it wants to achieve its goals by peaceful means, aims to establish a caliphate in Muslim regions of Russia, Uzbekistan, Tajikistan, Turkmenistan and Tajikistan.