A gunman shouting "Allahu Akbar" burst out of a bathroom at a McDonald's restaurant and opened fire on children before rampaging through a nearby shopping mall.

Ten are now confirmed dead, including the gunman, following the "shooting spree" at the shopping center in Munich, Germany.

Authorities have identified the shooter as Ali David Sonboly, 18, a taxi driver's son who had both German and Iranian citizenship. He had been living in Munich two years.

Sonboly used an illegal Glock 9mm pistol and was carrying 300 rounds of ammunition in his backpack when he went on what police are calling a "classic shooting rampage".

TRENDING: Alan Dershowitz sues CNN to halt 'malicious' attacks on innocent people

The pistol's serial number had been removed and police are now trying to trace how he came in possession of it.

Munich police believe the gunman killed himself less than a mile from the site of the shooting and "probably" acted alone, calming earlier fears there were three shooters on the loose. A robot was reportedly used by police to check his body for explosives before his ID could be ascertained.

Video posted to social media appear to show the gunman dressed in black outside the restaurant and firing into the crowd.

"I come out of the toilet and I hear like an alarm, boom, boom, boom," a witness named Loretta told CNN. "I saw the shooting of children, who were sitting down to eat. They could not run."

Loretta, who noted she is a Muslim, said she distinctly heard the man shout, "Allahu Akbar."

Authorities believe Sonboly either hacked another teen's Facebook page or created a false one to lure teens to McDonald's for free food. Many of his victims were children.

Roughly translated, the message read: "Come today to the McDonald's at 16 o'clock at the mall and I 'll buy you something, but nothing too expensive."

Following a raid on his parents' apartment, police discovered the Iranian-German was reading documents about 'spree shootings' before he carried out his attack. They also found a book, "Why Kids Kill: Inside The Minds of School Shooters," written by Dr Peter Langman, a psychologist expert who has written about shootings in the United States.

In another video posted on social media, a man driving by in a car can be heard calling the gunman an "ass----," and yelling at the suspect to "put your gun down."

"I am a German!" the gunman shouts back before firing more rounds.

According to a witness, a man also entered the shopping mall and began firing at random. The shooter then reportedly left the Olympia-Einkaufszentrum center and walked toward a railway station.

Other witnesses reported seeing at least three gunmen.

"We are at the moment after three attackers. We have about 100 people on site, and we are trying to evacuate people from the site. Our priority is to catch the attackers at this stage," said Police Chief Marcus Dagloria Martins.

The city was on lockdown, and authorities warned people to stay home or seek protection.

A woman who works in the mall said she heard "several shots."

"People started running. I went outside as well, more people running outside," Lynn Stein told CNN. "I think I heard more shots. Then it sounded like he went to the parking house next to the mall, several shots there."

In a video posted online, people can be seen running out of the building to seek shelter.

Thamina Stoll, a university student in Munich, tweeted video of the scene.

"At least 30 police cars on their way to #Munich #shoppingmall according to local radio station. Area around mall blocked by police," she wrote.

The shooting came just days after a teenage asylum seeker went on a rampage with an ax and a knife on a regional train in Germany, as WND reported.

The teen was shot dead by police, who happened to be nearby, but not before several people were seriously injured. ISIS has claimed responsibility for the attack.

The Telegraph carried a Reuters report that Islamic State terror organization supporters were celebrating on social media.

"Thank God, may God bring prosperity to our Islamic State men," read one tweet in Arabic on an account that regularly favors the radical Islamist movement, the report said.

Said another, "The Islamic State is expanding in Europe."

However, authorities say they have found no evidence Sonboly had any links to Islamic State or refugees.

Sonboly's apparent interest in mass shootings may possibly explain his choice of July 22 to carry out the attack.

The Mail noted the Munich shopping center shooting happened exactly five years after "far-right activist Anders Breivik" shot and killed dozens of people on a Norwegian island.

It was July 22, 2011, when Breivik exploded a car bomb in Oslo that killed eight people. He then drove to the island of Utoya where he gunned down 69 people, mostly teenagers, at a youth summer camp.

The report also noted the 1972 massacre in Munich involving the Israeli Olympic team.

On Sept. 5, 1972, eight members of the Palestinian terrorist organization Black September took the athletes hostage. The ordeal went on for 20 hours before snipers started shooting at the hostage-takers at the airport. Five of the terrorists and all 11 of the Israeli hostages were killed in the firefight.