Officials say they have taken the man responsible for hijacking an EgyptAir flight into custody, ending the hostage situation.