In early 1843, Honório Hermeto became the head of the cabinet, and so long as the "saquaremas" remained in power, Caxias was secure in his position. After Honório Hermeto quarreled with Pedro II a year later, he and the "saquaremas" resigned. The Liberals replaced the "saquaremas" in government, but Caxias was retained in his command. The War of the Ragamuffins took far longer to put down than had previous rebellions, but through careful negotiation and military victories, Caxias finally managed to pacify the province. The end of the armed conflict was declared on 1 March 1845. He was made a permanent field marshal on 25 March, and raised to the rank of count on 2 April. Caxias ran for a Senate seat, and being among the three candidates with the most votes, he was selected by the Emperor in late 1845 as the senator representing Rio Grande do Sul. He took his Senate seat on 11 May 1846.