INDONESIAN police arrested three men on suspicion of links to the brazen attacks in the heart of the country’s capital, and said they recovered a flag of the Islamic State group from the home of one of the attackers.

The arrests of the three took place at dawn at their homes in Depok on the outskirts of Jakarta, police said in a text message, citing Col. Khrisna Murti, director of criminal investigations who led the raid. It said they were arrested for suspected links to the attackers. MetroTV broadcast footage of the handcuffed men being escorted by police.

National police spokesman Anton Charliyan has told reporters that two of the five men were previously convicted and imprisoned for terrorism offences. He did not release any names.

ISIS has claimed responsibility for the grenades and crude homemade bombs used to stage the Paris-style attack in a busy business and shopping district that has left seven dead.

National police spokesman Anton Charliyan said that the terrorists were “from the ISIS group”.

“They claimed Indonesia will be in the world headlines,” he said.

He also said that when suspected terrorists were arrested before Christmas for allegedly planning attacks in Sumatra, Java and Kalimantan, police seized documents which suggested suspects were planning to “do a concert”.

The police spokesman said at the time it was not yet known what concert meant but in the past “bride” had been a code word for suicide bomber.

Australian Foreign Minister Julie Bishop said warnings of an attack in Indonesia had been coming “for some time”.

“Indeed we signed a further counter-terrorism agreement with Indonesia just recently in (light) of the fact that there has been an expectation that an attack would take place in our part of the world at some time,” she told the ABC.

Ms Bishop told Sky the government was “deeply concerned” about the threat of terror and the rise of Islamic extremism in our region.

“We have offered to support Indonesia in whatever way we can or they need to thoroughly investigate this incident,” she said.

She said yesterday’s attack could have been far worse.

“The fact that five terrorists, or suspected terrorists were killed would indicate that the Indonesian police efforts were very effective,” Ms Bishop said.

“Otherwise it could have been a lot worse given that these attacks took place in central Jakarta, in a very busy hub, in the middle of a teeming city and the five terrorists it would seem were killed.”

Ms Bishop confirmed an Islamic State terror cell was operating in Indonesia, but said she could not confirm reports Indonesian man Bahrun Naim was behind the attack.

“Australia has no embassy or presence in Syria and so information from that part of the world is obviously very hard to come by,” she said.

“But this man’s name has been known for some time. But he’s in Syria. He’s not in Indonesia.”

She said no Australians were believed to have been hurt in the attacks.

“We do understand that one foreigner — we believe a Canadian — and one police officer have been killed,” she said.

Opposition Leader Bill Shorten said the attacks were deplorable.

“Australia needs to keep working with Indonesia, they’ve got a successful track record,” he said.

“They’re determined to defeat terrorism and we need to work with our neighbours and reach out to Indonesia and help them deal with these issues.”

The Syrian civil war has been a source of inspiration for violent Islamists in Indonesia, and hundreds have travelled to Syria to join the Islamic State over the past several years. But recently they appear to have sought targets closer to home. Extremists claiming to represent the Islamic State carried out small-scale attacks in Indonesia and the Philippines last year.

Wild gunbattles between police and holed-up terrorists carried on throughout the day after the first explosion hit a Starbucks outlet near the Sarinah shopping mall shortly after 10.30am.

Indonesia’s minister for Politics, Legal, and Security affairs, Luhut Binsar Panjaitan, said after visiting the scene: “Five terrorists died, two civilians died, one of them a foreign national and one is Indonesian.”

OPINION: Why were these Indonesian places targeted?

MORE: Indonesia’s dark history of terrorism

MORE: Aussie man just 100m away from the blasts

The foreign national is reported to be a Canadian man who was shot in the carpark of Starbucks, the US-owned coffee shop franchise, located on a busy central Jakarta intersection and at the epicentre of the attacks.

Police said 20 people have been injured and some are critical, including a Dutch foreigner.

The brutal midmorning assault involving what Indonesian authorities say was five grenade detonations took place only two kilometres from the Presidential Palace of Joko “Jokowi” Widodo, who visited the scene late in the day.

Indonesian police have revealed Bahrun Naim, an Indonesian believed to be with the Islamic State in Syria, was behind the attacks.

“Our team has been analysing the link between this group with and an ISIS branch in Rakha (Iraq). There was an order from their emir (leader) Al Bagdadi to create ISIS branches all over the world,” Karnavian said.

He explained the link to IS in southeast Asia is led by Bahrum Naim, who wants to establish and IS group called Khatibah Nusantar.

“Bahrum Naim planned these attacks,” Karnavian stressed.

Mr Panjaitan said the first explosion went off inside the Starbucks shortly after 10.30am.

According to a contact at the scene, a security guard had alerted police that three men were acting strangely inside the Starbucks.

As the men were escorted over to a small police post at a nearby intersection, a blast went off inside the Starbucks. The three terrorists then tried to blow themselves up, along with the police post.

Two were killed by their own grenades, the other by police bullets.

Shortly after, there was by many accounts another explosion near the United Nations headquarters, several hundred metres away, but it now appears all explosions and shootings were concentrated in the Starbucks area.

EYEWITNESSES SPEAK

“I heard a loud bang, boom. It felt like an earthquake. We all went downstairs,” said Ruli Koestaman, 32, who had been in a nearby building when the attack started around 10.35am.

“We then saw that the Starbucks downstairs was destroyed too. I saw a foreigner — westerner, a man — with a mangled hand but alive.

“A Starbucks waiter then ran out with blood coming out of his ear. And I asked anyone hurt inside, he said yes, one. Dead already.

“Then everybody gathered and a terrorist appeared. He had a gun and started shooting at us and then at Starbucks. Then the police post ... exploded.”

Starbucks is closing all of its Jakarta branches “until further notice”, the global coffee giant said after one of its stores in the Indonesian capital was hit by apparent suicide attacks.

Jeremy Douglas, who works at the UN building on Jl Thamrin, said on Twitter that the explosions were followed by a “serious exchange of gunfire in downtown Jakarta”.

He was in a car pulling up to the building on the opposite side of the road when he heard at least five or six consecutive explosions.

“We got out of the car and heard the second bomb,” he told ABC TV.

“We went into the office then heard a third, a fourth a fifth, and the sixth and then gunfire in the streets.”

A witness named Husaini told reporters at the scene he saw a man emerge from the chaos with several guns and start shooting randomly, and then at police.

“Suddenly there was a man with a gun, maybe one or two guns,” he said.

“A policeman was shot in front of me.

“I helped take him to the Sari Pan Pacific (Hotel).”

Bombs detonate in Jakarta Vision of bombs being exploded outside a shopping mall in Jakarta, near the offices of the United Nations. Courtesy Twitter/robetbet.

A bank security guard said he saw at least five attackers, including three suicide bombers who exploded themselves in a Starbucks cafe in downtown Jakarta.

Tri Seranto told The Associated Press he was out on the street when he saw the three men entering Starbucks and saw them blowing themselves up one by one.

ISLAMIC STATE CLAIMS RESPONSIBILITY

Islamic State claimed responsibility for the attack on Jakarta.

“A group of soldiers of the caliphate in Indonesia targeted a gathering from the crusader alliance that fights the Islamic State in Jakarta through planting several explosive devices that went off as four of the soldiers attacked with light weapons and explosive belts,” the group said in a statement.

Islamic State’s statement said there were 15 people killed but the official tally according to the Indonesian government is seven.

Photos of one of the suspected attackers later emerged after the police shootout ended.

POLICE SEIZE ATTACKERS’ EXPLOSIVES

Images of explosives seized after the attack are typical of those deployed by homegrown terrorists waging a long-running insurgency against the Indonesian government out of Poso, in Sulawesi.

These insurgents are linked to IS and to convicted extremist Abu Bakar Bashir, who the day before the Jakarta strikes launched a legal review against his 15-year sentence for funding a terrorist training camp in Aceh, in northern Sumatra, in 2010.

Bashir, jailed and later of acquitted over his conviction for supporting the 2002 Bali bombings, last year pledged allegiance to IS from his cell on the prison island of Nusakambangan.

LONG AFTERNOON

Indonesian police were seen firing handguns into the Starbucks and had the building surrounded throughout the afternoon, with some reports that more attackers were holed up either in Starbucks or a neighbouring cinema complex.

Police spokesman Anton Charliyan said grenades rather than suicide vests were used, indicating this was a military-style operation that did not require detailed planning or bomb preparation.

Mr Charliyan said “one or two” of the attackers may have escaped into the city, but other reports suggested a number of terrorists were bunkered down and facing a barrage of counter-terror police.

As tanks arrived on the scene, Metro Jaya police spokesman Mohammad Iqbal told Indonesian television: “We have handled the situation. The situation has been saved.”

But even as he made these remarks, more shots sent people running. Police closed in and soon after declared the situation was under control.

Indonesian police have been on high alert for a terror attack they said would likely come from returned Islamic State combatants.

President Widodo told Metro TV: “Our nation and our people should not be afraid, we will not be defeated by these acts of terror, I hope the public stay calm.

“We all are grieving for the fallen victims of this incident, but we also condemn the act that has disturbed the security and peace and spread terror among our people.”

Foreign Minister Julie Bishop offered solidarity, offering “any support that Indonesia may need” to respond to the attacks.

“Our embassy is making urgent inquiries with local authorities to determine whether any Australians have been affected,” she said.

Ms Bishop said she had spoken to Indonesian Foreign Minister Retno Marsudi, offering “any support that Indonesia may need to respond to these attacks”.

She said Australians caught up in the attacks should avoid the area of the Sarinah Mall and follow the instructions of local authorities.

Anyone concerned about the welfare of a loved one should firstly attempt to contact them directly.

If unable to reach them, contact the Department of Foreign Affairs and Trade on 1300 555 135, or +61 2 6261 3305 (if calling from overseas).

The Department of Foreign Affairs and Trade said their overall level of advice has not changed in response to the attacks. “We advise you to exercise a high degree of caution in Indonesia, including Bali,” DFAT said.

AUSSIES TELL OF TERROR IN JAKARTA

Australians caught up in the chaos told of their terror.

Melbourne woman and Jakarta-based development worker Kate Walton said the Indonesian capital was eerily quiet and was on complete lock down as multiple gunmen were still on the loose.

Ms Walton, originally from Canberra, said she and her Indonesian colleagues were on lockdown in their high-rise Jakarta office building just 10 minutes from the fatal bombing site.

“Some people are rattled ... we have a couple workmates in a meeting where the bombing took place so we’re very concerned for their safety but we’re trying to stay calm,” Ms Walton said.

“Most people are worried about whether they’ll be able to get home safely, but we won’t be leaving until we get the all-clear.”

Ms Walton said she could hear frequent sirens and see fire engines and heavily armoured police vehicles patrolling the streets, but perhaps her most alarming observation is the complete absence of traffic.

“It’s eerily quiet ... what would usually be a congested freeway is completely dead ... it’s like the whole city’s shut down,” she said.

The daughter of a Melbourne woman was trapped on the 54th floor inside a high-rise building a few hundred metres from the explosions.

Law intern Tanika Eve, 24, said she was terrified after seeing black smoke clouds appear in the distance just before lunch.

“I heard this really loud bang and we saw smoke, we thought it came from a car and then we kept looking and suddenly there were four more coming from Starbucks,” Ms Eve said.

“We are scared to go downstairs.

“We heard that there are more explosions around Jakarta. We don’t know where to go. We don’t want to go home.”

Jack Gryfenberg, 23, from Melbourne, is undertaking an internship at the Centre for Strategic and International Studies in Jakarta, and was in his office 2km away when the attacks began.

“There were several raids in the Christmas/New Year period and officials thought that there would be an attack,” he said.

“There was no such attack and it seems like the attackers may have delayed their plans until today.

“Whether today’s attackers are connected to those arrested in the Christmas raids is, of course, unclear and far too early to speculate about.

“It’s calm here. I imagine at Sarinah it would be different.”

EXPATS WARNED TO STAY INDOORS

Carmel Gleeson, who has lived in Jakarta for two years, said Western embassies told their citizens to stay indoors.

She said the Australian community have been told the targets of the attacks are American but all foreigners were at risk.

“It is bloody frightening. We are about 6km from the attacks but live in an area where there are a lot of American diplomats so we are not safe. We are worried about the motorbikes.

“There are 10 of us here and our partners all work in the city. They are safe and in lockdown as well.”

She said some parents had been separated from children who were stuck at schools.

“They know they are safe but there is no way for them to go and get them now.”

Ms Gleeson said the area the attacks were in is a popular restaurant location that she ate at only last night.

Eko Widodo, who works at the nearby Atmajaya University, said he and colleagues heard the blasts and were being kept in the building.

“It’s dangerous in the street.

“I hope everything (is) okay,” he told News Corp Australia.

He says the other two attackers, carrying handguns, entered a police post from where he heard gunfire. He said he later saw one policeman dead and three seriously injured.

He says he was not injured in the explosions as he was a little distance away, but close enough to witness the attack.

Mohammad Reza, a security guard who was outside Starbucks when the attacks took place, described the scene of terror.

“I saw the explosions and window glass smashing. We helped two foreigners who were bleeding and we also helped five others ... three Indonesian women and two men who we put into official cars,” he said.

BOMB BLASTS COME AS NO SURPRISE

The deadly attacks were not a complete surprise to Indonesian authorities, who warned last month of a credible threat.

The government deployed 150,000 security personnel to safeguard churches, airports and other public places across the predominantly Muslim nation, and made a series of pre-emptive arrests.

The authorities have been keenly aware of the danger of terrorism since bombings in 2002 on the resort island of Bali killed more than 200 people, more than half of them foreign tourists.

*Additional reporting by Lia Nathalie and Komang Erviani