 This temple was actually built on the outermost wall of the old fort.The Thirumayam fort, set in , is of great historical importance.It was built by Kizhavan Sethupathi Vijaya Ragunatha Thevar, ruler of Ramanathapuram in AD 1687.