The remaining passengers taken hostage in March after gunmen bombed and attacked a train in northwest Nigeria have been freed, government and security officials said on Wednesday.
Gunmen blew up the tracks and assaulted the train travelling between the capital Abuja and Kaduna, killing eight people and kidnapping dozens in one of the most high-profile attacks this year.
"All 23 kidnapped victims of the ill-fated Kaduna train mishap released," Transport Minister Mu'azu Jaji Sambo said on Twitter.
A team had secured the release and took custody of passengers "held hostage by Boko Haram Terrorists following the attack on the Abuja to Kaduna train," a statement from a military committee said, without giving details on how they were freed.
Kaduna state security commissioner Samuel Aruwan confirmed the hostage release.
Security is a major concern for Nigerians as the country prepares for February elections to replace President Muhammadu Buhari, a former army general who is stepping down after two terms leading Africa's most populous country.
No group claimed the March 28 train attack though officials have blamed jihadists cooperating with heavily armed criminal gangs who terrorise parts of northwest and central Nigeria with looting raids and mass abductions.
Analysts said the sophisticated attack involving explosives showed Islamist militants could have participated.
Nigerian government officials often use the term Boko Haram loosely to refer generally to armed groups.
After halting the high-speed train, the gunmen opened fire on coaches before herding passengers from the train's so-called VIP section into the bush.
A week later, they freed one hostage -- a top bank executive -- as a goodwill gesture for the Muslim Holy month of Ramadan.
Groups of other train hostages had been released after negotiations earlier in the year.
The Kaduna train attack was one of several major incidents this year underscoring the challenge facing Nigeria's overstretched security forces.
In July, Islamic State group affiliates claimed a bold attack on a prison just 40 kilometres (25 miles) from Buhari's presidential villa in the capital, in a military embarrassment.
That attack -- the first major assault around the capital since 2014 -- showed militants were capable of threatening areas beyond their northeastern bastion.
Officials have become increasingly concerned that militants are cooperating for pragmatic reasons with criminal bandit gangs in the northwest, who are motivated by profit rather than ideology.
Nigeria's military is battling on multiple fronts -- a 13-year jihadist insurgency in the northeast, criminal militias in the northwest and separatist tensions in the country's southeast.