NEW DELHI — A Baptist pastor in Bangladesh has survived a knife attack by three men who had been invited to his home to discuss religion, the police said on Tuesday.

The attack on Monday comes after the killings of two foreigners in Bangladesh last week. The Islamic State claimed responsibility for the shooting deaths of an Italian aid worker in Dhaka and a Japanese man in northern Bangladesh, according to the SITE Intelligence Group, which monitors radical Islamic websites. The predominantly Muslim country has been grappling with a series of attacks on secular bloggers in the past year, and there is heightened concern over extremism.

The Rev. Luke Sarker, pastor of Faith Bible Church in the district of Pabna, in the country’s northwest, had met two of the men in his home on Sept. 18, along with a third man who was not present at the attack on Monday, said Mohammed Alomgir Kabir, a police superintendent in Pabna. They had discussed religion — including Christianity, Hinduism and Islam — and after the meeting, the men had arranged another gathering for Monday. At the second meeting, the two along with another man attacked Pastor Sarker, a Bangladeshi convert to Christianity in his early 50s, with a knife, Mr. Kabir said.