A Philippine official says two Germans kidnapped for six months have been released by a militant group just hours after it had threatened to behead one if no ransom payment was made.

Defense Secretary Voltaire Gazmin said the Abu Sayyaf group released Stefan Okonek and Henrike Dielen late Friday on southern Jolo Island.

Abu Sayyaf spokesman Abu Rami told radio station DXRZ in southern Zamboanga City that his group received 250 million pesos ($5.6 million) in ransom. He did not say who paid the ransom.

Gazmin said he was "not privy" to information about any ransom payment.

He said he was happy the Germans were safe and hoped there would be no more kidnappings.