ABUJA, Nigeria — Chad’s government said this week that its military had retaken a border town in Nigeria from the Islamist militant group Boko Haram, suggesting that momentum in the nearly six-year war against the group may finally be shifting.

Chad said that its forces had been attacked Tuesday along the Cameroon-Nigeria border and that they responded by crossing the frontier into the Nigerian town Gamboru Ngala, which has been held for months by Boko Haram.

The Islamists were “completely wiped out” there, with the death of nine Chadian soldiers and “more than 200” on the Boko Haram side, according to a statement from the Chadian government.

The Chadian incursion into Nigeria in pursuit of Boko Haram, its second in less than a week, underscores the failure of Nigeria’s own military to take on the Islamists despite years of civilian massacres by the militants in the country’s northeast.