After the resignation of President Ayaz Mutallibov on 6 March 1992, no official body regulated Gaziyev's actions, which provoked him to break ceasefire on a number of occasions including artillery bombardment of Nagorno-Karabakh's capital city Stepanakert. On 17 March 1992, Acting President of AzerbaijanYagub Mammadov appointed Gaziyev Defence Minister. Two months later, with various political groups chaotically struggling for power, both Shusha and Lachin lacked any serious or unified defence and quickly fell to the Armenians. In response, Gaziyev ordered troops to move to the north of the province. Mardakert was taken back in June 1992 and by August, Azerbaijani troops were already at Vank, 12 kilometres north of the province capital Stepanakert. Contrary to his radical anti-Russian sentiment in the late 1980s, Gaziyev was now convinced in the necessity of partnership with Russia. In November, the Azerbaijanis were dislodged from most of Mardakert. After Armenians started advancing into Kalbajar, the Popular Front, which had been in power since June 1992, issued a statement in which it blamed Rahim Gaziyev and Elchibey's official representative in Nagorno-Karabakh Surat Huseynov for treason and intentional surrender of Shusha in an attempt to restore Mutallibov as President and indulge Russia's geopolitical interests. Gaziyev was forced to resign in February 1993. After Heydar Aliyev came to power in June 1993, Gaziyev was elected to the National Assembly and was offered the position of Vice Premier for Defence Industry. However knowing that Azerbaijan at the time did not produce any defence materials which made the office of no significance, infuriated Gaziyev verbally attacked Aliyev during a parliament session calling him a liar. In an early 1996 interview, Gaziyev claimed having had a mutual agreement with Aliyev by which Gaziyev was to be appointed Deputy Prime Minister of Azerbaijan upon Aliyev's rise to power but was wronged for the sake of the latter's regionalist policies favouring natives of Nakhchivan.
Conviction and later pardon
Now confronting Aliyev's powerful figure Gaziyev was officially convicted of treason in surrendering Shusha to Armenians. He was detained in jail in August 1993 and was to be tried in court in November but managed to escape to Moscow, followed by Surat Huseynov. There he declared his full support of ex-President Ayaz Mutallibov who had been living in exile in Russia since summer of 1992 and ironically whom Gaziyev helped to have removed from power just two years earlier. On 16 April 1996Prosecutor General's Office of Russia decided that Gaziyev be deported to Baku where his sentence was replaced by life imprisonment in 1998. At the insistence of PACE, Rahim Gaziyev was pardoned and released in March 2005. After his release, Gaziyev published several articles in an attempt to rehabilitate himself in the public eye but was taken no interest in.
2020 arrest
On 13 July 2020, State Security Service and the Prosecutor General's Office released a joint statement, accusing Gaziyev of deliberately spreading "untrue information about the nature of the events on social network platforms", acting "to weaken the defense capabilities", and incite "riots and violent seizure of state power". Gaziyev was detained as a suspect in a criminal case under Articles 281 and 282 of the criminal code. Gaziyev's daughter Sevinj Jamilova responded to these allegations by saying that "these criminal codes have nothing to do with my father".