[citation needed] In 1853, Tun Ali declared his autonomy from the sultanate, paving the way for an independent Pahang, after two centuries of union with the crown of Johor.
The Bugis Yamtuan Muda supported the claim of Abdul Rahman to the sultanate, and succeeded in having him proclaimed ruler at Mahmud's grave-side.
The Yamtuan Muda, alarmed at the war-like preparations, made a complaint to the Resident of Malacca, and Adrian Koek was sent to warn the Bendahara that intervention in Lingga would give offence to the British Empire, so Tun Ali took his forces – which had been mobilized at Bulang – back to Pahang.
In the same year, the Bendahara refused to allow the British to hoist the Union Jack in his country, and assured Sultan Abdul Rahman of his allegiance, but he was soon to acknowledge Hussein.
In 1821, Abdul Rahman with his son Tengku Besar Muhamad, visited Pahang whence Bendahara Tun Ali escorted his sovereign to Terengganu.
[4] Jan Samuel Timmerman Thijssen, took the regalia of the Johor Sultanate by force from Tengku Puteri Hamidah at Pulau Penyengat in October 1822.
The new ruler visited Pahang, and too Bendahara Tun Ali to Lingga for the circumcision and installation of his son Tengku Besar Mahmud.
He enjoyed the advantage, of having no surviving uncles, and only one brother, Muhammad with whom he lived in friendly terms, and so had no familial threats to counter.
Pahang, with the exception of the rich tin-producing region of the river Kuantan which was kept as a private reserve by the Tun Ali, was free from import and export duties.
[8] Despite ruling Pahang as an independent fief, Tun Ali still recognised the sultan that resided in Daik, Lingga, now under Dutch control, as his overlord.
In 1844, in a warrant issued to the headman (Jenang) of the aboriginal tribes (suku biduanda) in the region of the river Anak Endau, Tun Ali described himself as "The representative of Sultan Mahmud Shah V, Dato' Bendahara Sri Wak Raja, son of the Bendahara Paduka Raja, Date 1221 (AH)".
[12][13] Long before his death in 1858, Tun Ali had retired from active participation in the government of the state, and moved his residence to Lami on the river of Pahang where he spent his declining years trying in a vain to help his son reconcile with each other.