US Secretary of State John Kerry and Bangladesh Prime Minister Sheikh Hasina have agreed to increase security cooperation between their two countries amid mounting attacks in the South Asian nation.

Kerry, who was on a nine-hour visit to the country, said the United States believed that elements of the Islamic State of Iraq and the Levant (ISIL) group were "connected" to operatives in Bangladesh.

"We, today, agreed on additional steps by which our intelligence and law enforcement will work together,” Kerry told reporters after meetings with the prime minister and other senior officials on Monday.

"We talked very openly about this and we made it very clear that there is evidence that ISIL in Iraq and Syria has contacts with about eight different entities around the world, and one of them is in South Asia," he said, according to the AFP news agency.

"They are connected to some degree with some of the operatives here and we made that very clear in our conversation. There was no argument about it," he said.

Bangladesh restaurants suffer after Dhaka attack

Economic development and human rights were also a focus of Kerry's visit, his first to Dhaka where an attack on a cafe in July killed 22 people, mostly foreigners.

ISIL, also known as ISIS, claimed responsibility for the July 1 attack in which armed men held hostage mainly Western diners at the cafe, including one American, before killing them.

Hasina's government denies ISIL has a presence in Bangladesh, instead blames the Jamayetul Mujahideen Bangladesh (JMB) and other local armed groups for the bloodshed.

Kerry said the US was working closely with Bangladesh and other partners to defeat "terrorism threats".

"We think there is much we can do to cooperate in this regard," Kerry said, adding that the US has already worked with Bangladeshi police, religious school students and conflict mitigation officials.

"So I'm confident that our assistance to Bangladesh will increasingly be designed to help the government address terrorism threats from domestic and trans-national organizations," he said.

'No outside threats'

As Kerry's motorcade headed to the US embassy in Dhaka for meetings with opposition leaders, a government minister directly contradicted the US diplomat.

"I told him that there is no such terrorist or militants from outside or who are connected with the [ISIL], but there are militants inside our country and they are homegrown," Home Minister Asaduzzaman Khan told Reuters news agency.

On Saturday, the suspected mastermind behind the cafe attack was reportedly killed by police in Dhaka, and hours before Kerry's arrival on Monday, Bangladesh police shot dead two suspected JMB members in the northern town of Sherpur.

INFOGRAPHIC: Bangladesh's soft targets

Bangladesh has been reeling from attacks over the past three years, including against foreigners, human rights activists, writers and members of religious minorities.

Critics say Hasina's administration has been in denial about the nature of the threat posed by armed groups and accuse her of trying to exploit the attacks to demonise her domestic opponents.

Source: Agencies