The so-called Islamic State (IS) was behind a series of explosions and gun attacks in the capital Jakarta, an IS-linked news agency and police say.At least two civilians and five attackers died in the assaults, described as an attempt to mimic the deadly Paris attacks.Security forces battled militants for hours, with the attacks centring on a major business and shopping district.It follows warnings late last year that Islamists were planning a major attack.

"Islamic State fighters carried out an armed attack this morning targeting foreign nationals and the security forces charged with protecting them in the Indonesian capital," the IS-linked news agency Aamaq reported.Jakarta Police chief Tito Karnavian said Indonesian national Bahrun Naim, currently thought to be in Syria, had been "planning this for a while".

National police spokesman Anton Charliyan said the perpetrators had "imitated" the Paris attacks, saying the authorities suspected a local group affiliated to IS. It is not clear who he was referring to.He said police had received warnings in November from IS they were planning a "concert in Indonesia", meaning an attack.

Two of the attackers were killed in a suicide bombing, police said, with the other three killed in gun battles with police.

A Canadian and an Indonesian national also died.

Indonesian President Joko Widodo has called on his country not to be defeated by "these acts of terror".

Several foreign governments advise caution while visiting Indonesia, with the UK Foreign Office urging its nationals to "maintain vigilance" after the attacks.

My brother is over in Jakarta at the moment. Visiting with his youngest daughter and grandchild, who live there. He is due to travel back here on 8th February.Foreign nationals are particularly being targeted. We worried about him being in Saudi Arabia, and so glad that he not there anymore. ..... Out of the frying pan - into the fire! .....