with the defeat of buenos aires in cepeda, the country was left without a head of state. an open cabildo in buenos aires elected a new governor, manuel de sarratea, who negotiated the treaty of pilar with ramírez and lópez. the treaty guaranteed national unity and a federalist system of government, the end of hostilities between the provinces, and called a new congress to decide a new national government. this congress, however, was never called because of the ongoing wars. the banda oriental was invaded by brazil, but ramírez and lópez feared that by joining the war their provincies would be invaded as well, so they agreed instead a defense pact with buenos aires. this pact would be ratified by the quadrilateral treaty of 1822. during this period, the provinces maintained national unity though treaties, being ruled by caudillos.