Hamas to take legal action against UK for declaring it terror group