Militants launched a gun and bomb assault in the center of the Indonesian capital on Thursday, killing at least six people, police said, in an attack on a country that Islamic State had threatened to put in its "spotlight".
While suspicion is likely to fall on Islamic State or its allies, police said they did not know who was responsible and President Joko Widodo urged the public not to speculate on who was behind the attack.
Police said there were at least six explosions and they had shot dead three of the attackers and captured four. Three suicide bombers were suspected to have been involved while three policemen and three civilians were also killed, they said.
The main thrust of the attack was on an office block and it began with a blast outside a Starbucks cafe on its ground floor.
"The Starbucks cafe windows are blown out. I see three dead people on the road. There has been a lull in the shooting but someone is on the roof of the building and police are aiming their guns at him," said a Reuters photographer.
Indonesia has been on edge for weeks over the threat posed by Islamist militants and counter-terrorism police have launched a crackdown on people with suspected links to Islamic State.
"We have previously received a threat from Islamic State that Indonesia will be the spotlight," police spokesman Anton Charliyan told reporters.
The last major militant attacks in Jakarta were in July 2009, with bombs at the JW Marriott and Ritz Carlton hotels.
Media reported that a Dutch person and another foreigner were among the casualties on Thursday but it was unclear if they were dead or wounded.
Police snipers were deployed among hundreds of other security officers, some in armored vehicles.
A bomb disposal unit was seen entering the building where the Starbucks is located, which also houses a cinema where at one stage, police exchanged fire with gunmen.
An office worker the building, who declined to be identified, said he and fellow workers had been ordered to stay put after the first blast.
"That's when I heard the second explosion. It was loud and powerful," he said.
Several hours after the attacks began, the witness heard more gunfire and at least one more explosion. A couple of hours later police said they were combing the building and they later declared the area secure.
Outside, a body still lay on the street and a shoe lay nearby. The city center's notoriously jammed roads were largely deserted.
President Widodo was outside Jakarta when the attack unfolded but was cutting short his trip to return to the sprawling capital of more than 10 million people by helicopter.
He urged the public not to be cowed.
"We must not be afraid, we must not be defeated by an act of terror like this," he said in televised comments.
The national intelligence agency chief said there was no indication that Islamic State militants had carried out the attack.
Several embassies are also in the vicinity of the attack. Indonesia's central bank, located in the same area, went ahead with a policy meeting as the violence unfolded, cutting its policy rate by 25 basis points to 7.25 per cent.
Economists said Southeast Asia's biggest economy could be hurt by the violence.
Early in the attack, one explosion went off in front of the Sarinah shopping center. Media said a police post outside the mall was blown up.
A nearby UN building was in lock-down with no one allowed in or out, a witness said. Some other high-rise buildings in the area were evacuated.
Indonesia has the world's largest Muslim population, the vast majority of whom practise a moderate form of the religion.
The country saw a spate of militant attacks in the 2000s, the deadliest of which was a nightclub bombing on the holiday island of Bali that killed 202 people, most of them tourists.
Police have been largely successful in destroying domestic militant cells since then, but officials have more recently been worrying about a resurgence inspired by groups such as Islamic State and Indonesians who return after fighting with the group.
Alarm around the world over the danger stemming from Islamic State rocketed after the Paris attacks in November and the killing of 14 people in California in December.
On Tuesday, a Syrian suicide bomber killed 10 German tourists in Istanbul. Authorities there suspect the bomber had links to Islamic State.
Among those arrested in Indonesia's crackdown late last year was a member of China's Uighur Muslim minority with a suicide-bomb vest. Media said two other Uighur suspects were on the run.
Indonesian security forces have also intensified a manhunt for a militant leader called Santoso, regarded as Indonesia's most high-profile backer of Islamic State, in the jungles of Sulawesi island.
Santoso had threatened to unleash attacks in Jakarta.