The government blamed the attack on Islamist insurgency Boko Haram. The attack on the Abuja-Kaduna train led to the suspension of a service that was popular with passengers who feared attacks and kidnappings by gunmen on Nigerian highways.

Usman Yusuf, secretary to the chief of defence staff, said in a statement that the military had "secured the release and taken custody of all the 23 passengers held hostage by Boko Haram terrorists."

He did not provide details.

Nigeria's state railway company initially said it could not account for 168 people who according to a passenger log had booked to travel on the train. Most were later traced to their homes, but 65 were confirmed missing.

The kidnappers had been releasing hostages in batches.

(Reporting by MacDonald Dzirutwe; Editing by Alexandra Hudson)