Ismail Haniyeh, who was from Gaza but had lived in Qatar for several years, was with the heads of other regional armed groups backed by Iran at a ceremony for the swearing-in of the country's new president.