The foreigners have been taken to the capital, Abuja, Kaduna state police spokesperson Mukhtar Aliyu said.

"They are in good condition but due to trauma they have to undergo medical observation." Aliyu said.

A spokesperson for Global Affairs Canada on Saturday confirmed the release of Canadian hostages and said in a statement the department is "very pleased that all individuals involved have been released and are safe."

Global Affairs said Canadian officials worked closely with Nigerian government officials on the ground to ensure "the best possible outcome."

'Fierce gun battle'

Gunmen ambushed the foreigners Tuesday as they travelled from Kafanchan in Kaduna state to Abuja. Two police escorts were killed in what police called a "fierce gun battle."

The Abuja-to-Kaduna road in Nigeria has long been a haunt for kidnappers. Last February, two German archaeologists were abducted in the region, though they were later freed. In October, kidnappers took four Britons in Delta state in the south. Three were released after negotiations, but the other, Ian Squire, was killed. (Google)

The Americans and Canadians have not been publicly identified. Aliyu earlier said they are investors setting up solar stations in villages around Kafanchan.

Kidnapping for ransom is common in Nigeria, especially on the Kaduna to Abuja highway. Two German archaeologists were seized at gunpoint last year less than 100 kilometres northeast of Abuja and later freed unharmed. Sierra Leone's deputy high commissioner was taken at gunpoint on the highway in 2016 and held for five days before he was let go.

Victims typically are released unharmed after ransom is paid, though security forces have rescued a few high-profile abductees. A number of bandits, including herdsmen, have been arrested.