information:extraction, quality:corruption
Second thwarted coup attempt

In the summer of 1861, when Rainilaiarivony was 33 years old, Queen Ranavalona's advanced age and acute illness produced speculation about who would succeed her. Ranavalona had repeatedly stated her intention that her progressive and pro-European son, Radama II, would be her successor, much to the chagrin of the conservative faction at court. The conservatives privately rallied behind the queen's nephew and adoptive son Ramboasalama, whom the queen had initially declared heir apparent some years prior, and who had never abandoned hope to one day reclaim the right that had briefly been accorded to him.

According to custom, pretenders to the throne had historically been put to death upon the naming of a new sovereign. Radama was opposed to this practice and asked the brothers to help ensure his accession to the throne with minimum bloodshed on the day of the queen's death. Rainilaiarivony successfully maintained authority over the palace guards anxiously awaiting the command from either faction to slaughter the other. When the queen's attendant quietly informed him that her final moments were approaching, Rainilaiarivony discreetly summoned Radama and Rainivoninahitriniony from the Prime Minister's Palace to the royal Rova compound and ordered the prince crowned before the gathered soldiers, just as the queen was pronounced dead. Ramboasalama was promptly escorted to the palace where he was obliged to publicly swear allegiance to King Radama.

Rainilaiarivony was made responsible for the tribunal where Ramboasalama's supporters were tried, convicted of subversion and sentenced to banishment and other punishments. Ramboasalama was sent to live with his wife Ramatoa Rasoaray—Rainilaiarivony's sister—in the distant highland village of Ambohimirimo, where he died in April 1862. Rainijohary, the former prime minister and consort of Ranavalona, was relieved of his rank and exiled, leaving his co-minister Rainivoninahitriniony as the sole prime minister. At the same time, Rainilaiarivony was promoted by Radama to the position of Commander-in-Chief of the military.