In 1801, Melo e Castro was named Secretary of State of Foreign Affairs and War by John, Prince Regent, with the demanding task of reorganising the Portuguese Army, badly ravaged following the War of the Oranges, due to the imminent threat of the European conflict. When Portugal and France re-established diplomatic relations following the signing of the Treaty of Amiens and the brief interval of peace in Europe, Jean Lannes was sent as the French ambassador to Portugal: he soon clashed with Melo e Castro (who he described as "a man of the English") and demanded his dismissal (a demand that was soon after endorsed by Napoleon). Melo e Castro was stripped of his office in August 1803.