JAKARTA, Indonesia (AP) – Attackers set off suicide bombs and exchanged gunfire outside a Starbucks cafe in Indonesia’s capital in a brazen assault Thursday that police said "imitated" the recent Paris attacks. Backers of the Islamic State group claimed responsibility.

All five attackers and two bystanders – a Canadian and an Indonesian – died in the midmorning explosions and gunfire that were watched by office workers from high-rise buildings on Thamrin Street in Jakarta, not far from the presidential palace and the U.S. Embassy, police said. Twenty people were injured.

When the area was finally secured a few hours later, bodies were sprawled on sidewalks. But given the firepower the attackers carried – handguns, grenades and homemade bombs – and the soft targets they picked in a bustling, crowded area, the casualties were relatively few compared to the mayhem and carnage caused by the Paris attacks.

"We have identified all attackers … we can say that the attackers were affiliated with the ISIS group," national police spokesman Maj. Gen. Anton Charilyan told reporters, referring to the Islamic State group.

Islamic State group backers circulated a claim of responsibility for the attacks resembling the extremist group’s previous messages.

The claim was shared on Twitter late Thursday. The U.S.-based SITE Intelligence Group said it also circulated among pro-Islamic State groups on the message app Telegram.

The message said attackers carried out the assault in Jakarta and had planted several bombs with timers. It differed from Indonesian police on the number of attackers, saying there were four. It said they wore suicide belts and carried light weaponry.

The statement could not be independently verified by The Associated Press, though it resembled previous claims made by the group, which controls territory in both Iraq and Syria.

Jakarta police chief Maj. Gen. Tito Karnavian told a news conference that the first suicide bombing happened at a Starbucks restaurant, causing customers to run out. Outside, two gunmen opened fire, killing a Canadian and wounding an Indonesian, he said.

A Dutch Foreign Ministry spokeswoman in the Netherlands said a Dutch man was seriously injured and was undergoing surgery.

At about the same time two other suicide bombers attacked a nearby traffic police booth, killing themselves and an Indonesian man. Karnavian said that minutes later a group of policemen was attacked by the remaining two gunmen, using homemade bombs. This led to a 15-minute gunfight in which both attackers were killed, he said.

Police then combed the building housing the Starbucks and another nearby building where they discovered six homemade bombs – five small ones and a big one.

"So we think … their plan was to attack people and follow it up with a larger explosion when more people gathered. But thank God it didn’t happen," Charilyan said.

He said the attackers imitated the recent "terror acts" in Paris and were likely from the Islamic State group, but gave no evidence.

Karnavian also said the attackers had links with IS and were part of a group led by Bahrum Naim, an Indonesian militant who is now in Syria.

It was the first major attack in Indonesia’s capital since the 2009 bombings of two hotels that killed seven people and injured more than 50. Before that, bombings at nightclubs on the resort island of Bali in 2002 killed 202 people, mostly foreigners.

Thursday’s attack prompted a security lockdown in central Jakarta and enhanced checks all over the crowded city of 10 million. Thamarin Street is home to many luxury hotels, high-rise office buildings and embassies, including the French.

Eliaz Warre, who witnessed the attack, said he was riding on a motorbike when the explosion went off at the police post. "I saw people running away and two people lying on the ground bleeding," he said.

Charilyan said police had received information in late November about a warning from the Islamic State group that "there will be a concert" in Indonesia, meaning an attack.

"This act is clearly aimed at disturbing public order and spreading terror among people," President Joko "Jokowi" Widodo said in a statement on television.

"The state, the nation and the people should not be afraid of, and be defeated by, such terror acts," he said.

The country had been on high alert after authorities said they foiled a plot by Islamic militants to attack government officials, foreigners and others. About 150,000 police officers and soldiers were deployed on New Year’s Eve to guard churches, airports and other public places.

More than 9,000 police were also deployed in Bali.

Last month, anti-terror police arrested nine suspected militants and said they had planned attacks "to attract international news coverage of their existence here."

After the explosions at Starbucks, sporadic gunfire could be heard for about two hours. Police helicopters hovered overhead as anti-terror squad troops rushed in. Reporters and bystanders were kept behind police lines.

Tweets from the account of Jeremy Douglas, a regional representative of the U.N. drugs office, described a bomb and "serious" exchanges of gunfire on the street outside his office. "Didn’t experience this in 3.5 years in #Pakistan," he wrote.

On Tuesday, jailed radical Islamic cleric Abu Bakar Bashir appealed to an Indonesian court to have his conviction for funding a terror training camp overturned, arguing that his support for the camp was an act of worship.

The 77-year-old leader of the Jemaah Islamiyah militant network filed a judicial review of his 2011 conviction, when he was sentenced to 15 years in jail for setting up the camp in Aceh province. A higher court later cut the sentence to nine years.

Indonesia, the world’s most populous Muslim nation, has suffered a spate of deadly attacks blamed on the Jemaah Islamiyah network in the past. But militant strikes in recent years have been smaller and less deadly, and have targeted government authorities, mainly police and anti-terrorism forces.

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.