The prisoners were released in exchange for four female hostages held by Hamas in Gaza.