The so-called Islamic State (IS) group has claimed responsibility for a truck attack on a crowded Berlin Christmas market that left 12 people dead and nearly 50 injured.

The news came as German security forces hunt for the perpetrator of the attack after releasing a man from custody due to a lack of evidence.

IS said in a statement from its Amaq news agency that the attacker "in Berlin is a soldier of the Islamic State and carried out the attack in response to calls for targeting citizens of the Crusader coalition".

Germany is not involved in anti-IS combat operations, but has Tornado jets and a refuelling plane stationed in Turkey in support of the coalition fighting militants in Syria, as well as a frigate protecting a French aircraft carrier in the Mediterranean, among other assets.

The claim of responsibility came not long after German prosecutors said they had released a man arrested on Monday night near the scene of the attack, initially suspected of driving the truck. The man, a Pakistani citizen who came to Germany last year, had been picked up based on a description of a suspect who jumped out of the truck and fled.

But federal prosecutors said he denied any involvement and they had found no forensic evidence proving he was in the cab during the rampage.

Federal Criminal Police Office chief Holger Muench and other officials had expressed doubt earlier that the man in custody was driving the truck at the time of the attack. Mr Muench also said police have not yet found a pistol authorities believe was used to kill a Polish truck driver who was supposed to be delivering the steel beams the truck was carrying.

Berlin police, meanwhile, urged people to remain "particularly vigilant" and report "suspicious movements" to a special hotline.

"We may still have a dangerous criminal out there," Berlin police chief Klaus Kandt said.

Before Islamic State claimed responsibility, Germany's top prosecutor, Peter Frank, told reporters the attack on the market outside the landmark Kaiser Wilhelm Memorial Church was reminiscent of July's deadly truck attack in Nice and appeared to follow instructions published by the militant group.

"There is also the prominent and symbolic target of a Christmas market, and the modus operandi that mirrors at least past calls by jihadi terror organisations," Mr Frank said.

Germany's Chancellor Angela Merkel insisted the attack cannot change Germans' way of life.

"Twelve people who were still among us yesterday, who were looking forward to Christmas, who had plans for the holidays, aren't among us anymore," she said in an emotional, nationally televised statement before heading to the scene of the attack in Berlin.

"A gruesome and ultimately incomprehensible act has robbed them of their lives."

Later, Mrs Merkel and German President Joachim Gauck attended a memorial service at the Kaiser Wilhelm Memorial Church and laid white roses outside the church.

Witnesses saw only one man flee from the truck after it rammed into the crowd at the Christmas market, smashing wooden stalls and travelling 60 to 80 metres (200 to 260 feet) before coming to a halt.

Six of those killed have been identified as Germans, and a man found shot and killed in the truck's passenger seat was Polish. The other five people killed have not yet been identified. Twenty-five people remained in hospital, 14 with serious injuries.

Mrs Merkel, who has been criticised for allowing in huge numbers of migrants last year, addressed head-on the possibility that an asylum-seeker was responsible for the carnage.

"I know that it would be particularly hard for us all to bear if it were confirmed that a person committed this act who asked for protection and asylum in Germany," Mrs Merkel said. "This would be particularly sickening for the many, many Germans who work to help refugees every day and for the many people who really need our help and are making an effort to integrate in our country."

A spokesman for Berlin's office for refugee affairs said police conducted a broad search overnight at a large shelter for asylum-seekers at the city's now-defunct Tempelhof airport. Four men in their late 20s were questioned but no one was arrested, Sascha Langenbach told The Associated Press.

The Polish owner of the truck said he feared the vehicle had been hijacked. Ariel Zurawski said he last spoke with the driver, his cousin, around noon on Monday and the driver told him he was in Berlin and scheduled to unload on Tuesday morning.

"They must have done something to my driver," he told broadcaster TVN24.

Germans have been increasingly wary since two attacks by asylum-seekers last summer that were claimed by the Islamic State group. Five people were wounded in an axe rampage on a train near Wuerzburg and 15 wounded in a bombing outside a bar in Ansbach, both in the southern state of Bavaria. Both attackers were killed.

Those attacks and two others unrelated to Islamic extremism in the same week-long period, contributed to tensions in Germany over the arrival last year of 890,000 migrants.

Far-right groups and a nationalist party seized on Monday night's attack, blaming Mrs Merkel for what happened.

"Under the cloak of helping people Merkel has completely surrendered our domestic security," Frauke Petry, the co-chairwoman of the Alternative for Germany party, wrote.

The German government said Mrs Merkel spoke on Tuesday with US President Barack Obama, who expressed his condolences. In Washington, White House National Security Council spokesman Ned Price said the United States was ready to help in the investigation and response.

US President-elect Donald Trump said Islamic extremists must be "eradicated from the face of the Earth" and pledged to carry out that mission with all "freedom-loving partners".

The attack came less than a month after the US State Department warned that extremist groups, including Islamic State and al Qaida, were focusing "on the upcoming holiday season and associated events" in Europe.