LAGOS, Nigeria - An official says 42 people including 27 students who were abducted two weeks ago from a school in northern Nigeria have been freed.

The chief press secretary for the Niger state governor, Mary Noel-Berje, told The Associated Press on Saturday that those released have arrived in the state capital, Minna. “We have received them,” she said.

The students, teachers and family members were abducted by gunmen from the Government Science College Kagara.

Their release was announced a day after police said gunmen had abducted 317 girls from a boarding school elsewhere in northern Nigeria, in Zamfara state. One resident said the gunmen also attacked a nearby military camp and checkpoint, preventing soldiers from interfering with the mass abduction.

Several large groups of armed men operate in Zamfara state, described by the government as bandits, and are known to kidnap for money and to push for the release of their members from jail.

Nigerian President Muhammadu Buhari said Friday the government's primary objective is to get all the school hostages returned safe, alive and unharmed.

“We will not succumb to blackmail by bandits and criminals who target innocent school students in the expectation of huge ransom payments,” he said. “Let bandits, kidnappers and terrorists not entertain any illusions that they are more powerful than the government.”

Nigeria has seen several such attacks and kidnappings over the years, notably the mass abduction in April 2014 by jihadist group Boko Haram of 276 girls from the secondary school in Chibok in Borno state. More than a hundred of the girls are still missing.

In December, 344 students were abducted from the Government Science Secondary School Kankara in Katsina State. They were eventually released.