DAKAR, Senegal — With the regional war against the Boko Haram militant group widening, Niger’s Parliament has agreed to send troops across the border to join the fight.

The vote was unanimous in the National Assembly on Monday night, reflecting the shock produced by at least four attacks in Niger in less than a week, including an explosion at a market in the country’s east that killed a number of civilians.

Chad, Cameroon and Benin have also agreed to contribute troops to an 8,700-member force to fight Boko Haram. Attacks by the militant group, which is based in Nigeria, have increasingly spilled across borders in the region.

Nigeria’s war has spread to its smaller, poorer neighbor, Niger. In Diffa, the main city in the country’s far east, just across the border from Nigeria, “people are in a panic,” the head of the Red Cross in Diffa, Abdullai Adah, said by phone on Tuesday, after a bombing at a vegetable market and an attack on the city’s prison the day before. At least eight were killed, Mr. Adah said.