During the 14th century, invasions by the Sultanate of Delhi weakened the Hoysala state, and the district became part of the Vijayanagara Empire. In the 15th and 16th centuries, the Vijayanagar kings patronised Chennakesava of Belur as their family deity. It was also ruled by Adilshahis of Bijapur and Mughal Empire after decline of the Vijayanagar. In the 17th and 18th centuries, Hassan became a land of contention between the Keladi Nayakas of Shimoga and the Mysore Kingdom. In 1648 the Mysore rulers built Channarayapatna fort by treaty with the sultans of Bijapur. A peace treaty was concluded between the Mysore and Keladi rulers in 1694. The district remained part of the Mysore Kingdom at the conclusion of the Fourth Anglo-Mysore War in 1799.