He was born around 1760 to Muhammad Husayn khan Mushtaq and Qizkhanum. He was sent to Haji Khan by his father to negotiate peace who in turn imprisoned and sent him to be executed by Ibrahim Khalil khan. However, he was spared and kept hidden for 3 years when he was sent to claim his throne in 1783, killing his uncle and cousins after a successful conquest.
First reign
One of his first acts was to blind his half-brotherFatali and put in house arrest who was more favored by Arash Mahal nobility. Which caused Salim Khan, another half-brother to flee to Djaro-Belokani in 1784/1785. Salim Khan occupied Shaki when Muhammad Hasan travelled to visit new Qajar shah Agha Muhammad in Karabakh on November/December of 1795. While Salim Khan lost the battle near Goynuk, a sudden arrest of Muhammad Hasan by Mostafa khan Davalu on the charge of treason, led him to re-occupy Shaki using the opportunity. Muhammad Hasan khan was blinded by Qajars and sent to Tabriz as hostage, meanwhile his 7 underage sons were executed by Salim Khan.
Second reign
He was restored to power during Agha Muhammad's reconquest of Transcaucasus in 1797. He deposed Salim Khan on 9 May 1797 with help from Qajars while other sources state he was supported by Mustafa khan of Shirvan. His 8 year long second reign came to an end when his relationship with Shirvan strained again. His domains were invaded by Salim Khan who was now supported by Mustafa khan, however instead of battling, he surrendered himself to Mustafa khan, who spared him and sent viceroys to govern Shaki as a part of Shirvan. While Salim Khan informed his brother Fatali of this betrayal, locals enthroned Fatali Khan instead of Muhammad Hasan in defiance of Shirvan.
Later years
He was spared by Mustafa khan spent rest of his life in exile, wandering Quba Khanate, Ottoman Empire, Qajar Iran and Dagestan to gather support. He marched on Gazikumukh Khanate armies on Shaki sometime later in vain, ultimately settled in Tbilisi with his son and was granted with 150 rubles monthly pension. However he was exiled again to Kharkov and Astrakhan by Russian authorities in suspicion related to Shaki revolt of 1814. He died in 1831 and was buried in Shaki Khan's Mosque.
Family
He had at least 8 wives and some issues with them: