The U.N. secretary-general is condemning "in the strongest terms" the beheading of a group of Egyptian Christian hostages in Libya and is blaming the Islamic State group.

The statement issued Monday by the spokesman for Ban Ki-moon says the secretary-general "deplores the targeting of people on account of their religious affiliation."

The U.N. Security Council late Sunday strongly condemned what it called the "heinous and cowardly apparent murder" of the 21 Egyptians and blamed it on an affiliate of the Islamic State group.

The council statement also demanded the immediate release of all held hostage by the militant group or anyone associated with al-Qaida.

Ban and the council stressed a political solution to the crisis in Libya, which has split into two governments, one of them led by Islamist politicians.