Although they were still allies, San Martín began to distance himself from Alvear, who controlled the Assembly and the lodge. Alvear opposed the merchants and the Uruguayan caudillo José Gervasio Artigas, San Martín thought that it was risky to open such conflicts when the royalists were still a threat. The Army of the North, which was operating at the Upper Peru, was defeated at the battles of Vilcapugio and Ayohuma, so the triumvirate appointed San Martín to head it, replacing Manuel Belgrano.