Meanwhile, Rajrajeshwari, perhaps due to frustration over her debauch husband, or due to political reasons, left Varanasi, entered the border of Nepal on 26 July 1801, and taking advantage of the weak regency, was slowly making her way towards Kathmandu with the view of taking over the regency. Back in Kathmandu, the court politics turned complicated when "Mulkaji" (or chief minister) Kirtiman Singh Basnyat, a favorite of the Regent Subarnaprabha, was secretly assassinated on 28 September 1801, by the supporters of Rajrajeswori. In the resulting confusion, many courtiers were jailed, while some executed, based solely on rumors. Bakhtawar Singh Basnyat, brother of assassinated Kirtiman Singh, was then given the post of "Mulkaji" During his tenure as the "Mulkaji", on 28 October 1801, a Treaty of Commerce and Alliance was finally signed between Nepal and East India Company. This led to the establishment of the first British Resident, Captain William O. Knox, who was reluctantly welcomed by the courtiers in Kathmandu on 16 April 1802. The primary objective of Knox's mission was to bring the trade treaty of 1792 into full effect and to establish a "controlling influence" in Nepali politics. Almost eight months after the establishment of the Residency, Rajrajeshwari finally managed to assume the regency on 17 December 1802.