Unhappy with this change of policy by the Portuguese government, Napoleon negotiated a secret treaty with Charles IV of Spain and sent an army to invade Portugal.