During Hart's tenure in the Maritime Customs, Prince Gong was head of the Zongli Yamen, the newly established Chinese equivalent of the British Foreign Office, and the two men held each other in high regard. Hart was so well known in the Zongli Yamen that he was affectionately nicknamed "our Hart" (wǒmen de Hèdé, 我們的赫德). He also often worked closely with the powerful Viceroy, Li Hongzhang and their final work together involved negotiating a settlement China could tolerate at the end of the Boxer Rebellion, when the Eight-Nation Alliance of Western forces took control of Peking to lift the Siege of the International Legations, after the Dowager Empress and her nephew the Guangxu Emperor had fled the city.