STOCKHOLM (Reuters) - A failed asylum-seeker accused of ramming a truck into a Stockholm crowd last week, killing four people, has confessed to committing a terrorist crime, his lawyer said on Tuesday.

Uzbekistan man Rakhmat Akilov, wanted for deportation at the time of Friday’s attack, made his first court appearance, entering the heavily guarded courtroom with a green sweater over his head and flanked by his lawyer and a translator.

Police say they believe the 39-year-old hijacked a beer truck and drove it into a busy pedestrian street in the Swedish capital before crashing into a department store.

Two Swedes, a British man and a Belgian woman were killed in the attack. Fifteen were injured. Eight people remain in hospital, including two in intensive care.

The attack has shattered any sense Swedes had of being insulated from the militant violence that has hit other parts of Europe, but has prompted defiance from Prime Minister Stefan Lofven who says Sweden will remain an open, tolerant society.

Akilov, who was asked by the judge to remove the sweater from his head, made no comment at the start of the hearing. His lawyer, Johan Eriksson, told the court that his client had admitted the crime. The judge then ordered the hearing to proceed behind closed doors.

Eriksson later told reporters outside the court that Akilov has described his motives to authorities, but the judge had ordered the lawyer not to discuss details of the case in public.

“He has not just confessed. He has provided information, he is answering questions,” Eriksson said.

Akilov was arrested just hours after the truck attack on the highest level of suspicion in the Swedish legal system. He had already been wanted by police for failing to comply with a deportation order after being denied permanent residency.

Slideshow ( 3 images )

The judge on Tuesday remanded Akilov in custody for a month. Police have said it could take up to a year to complete the initial investigation into the attack.

Police say Akilov has expressed sympathies with extremist organisations. Security services have said that he had figured in intelligence reports but they had not viewed him as a militant threat.

Slideshow ( 3 images )

A Facebook page appearing to belong to him showed he was following a group called “Friends of Libya and Syria”, dedicated to exposing “terrorism of the imperialistic financial capitals” of the United States, Britain and Arab “dictatorships”.

Legal documents show Akilov had asked for Eriksson to be replaced by a Sunni Muslim lawyer, but the court denied his request.

“We have a good relationship and we are working together in this case,” Eriksson said on Tuesday.

Sweden’s prosecution authority said on Tuesday it had revoked the arrest of a second, unidentified suspect in connection with the truck attack.

However, this man would remain in custody due to an earlier decision that he be expelled from Sweden, the authority said.

“According to the prosecutor, the suspicions have weakened and there is, therefore, no ground to apply for a detention order,” it said in a statement.