ராவணனை வென்று இலங்கையிலிருந்து திரும்பும் வழியில், ராமபிரான் ஒரு பெரும் கவலையில் இருந்தார். ராவணன் ஒரு பிராமணனாகவும், சிவபக்தனாகவும் இருந்தமையால், அவனைக் கொன்றதன் பாவம் தன்னை சேரும் என்று உணர்ந்தார். இந்த பிராமணஹத்தி தோஷத்தை நீக்க, அவர் சிவபெருமானை வழிபட விரும்பினார்.
இலங்கையிலிருந்து திருவுருவைக் கொண்டுவர ஹனுமானை அனுப்பினார். ஆனால் முகூர்த்த நேரம் நெருங்கியும் ஹனுமான் திரும்பவில்லை. எனவே சீதாதேவி கடற்கரை மணலால் ஒரு சிவலிங்கத்தை உருவாக்கி, ராமர் அதை வழிபட்டார். இதுவே 'ராமலிங்கம்' என்று அறியப்படுகிறது. பின்னர் ஹனுமான் கயிலாயத்திலிருந்து கொண்டுவந்த லிங்கம் 'விஸ்வலிங்கம்' என அழைக்கப்பட்டு, அதையும் முக்கிய சன்னதியில் வழிபடும்படி ராமர் கட்டளையிட்டார்.
இந்த நிகழ்வின் நினைவாக கட்டப்பட்ட ராமநாதசுவாமி கோயில், இன்று இந்தியாவின் நான்கு திருத்தலங்களில் (சார் தாம்) ஒன்றாகவும், பன்னிரண்டு ஜோதிர்லிங்கங்களில் ஒன்றாகவும் கருதப்படுகிறது — வைஷ்ணவ, சைவ மரபுகள் இரண்டும் சங்கமிக்கும் அரிய தலம். கோயிலின் 1212 மீட்டர் நீளமுள்ள திருச்சுற்று உலகின் மிக நீளமான கோயில் தாழ்வாரமாக அறியப்படுகிறது.
Returning from Lanka after defeating Ravana, Lord Rama was deeply troubled. Since Ravana was a Brahmin and a devotee of Shiva, Rama felt the sin of killing him weighing on him. To atone for this sin of Brahmahatya, he wished to worship Lord Shiva.
He sent Hanuman to Kailash to bring back a sacred lingam. But as the auspicious moment for worship approached and Hanuman had not yet returned, Sita Devi shaped a lingam from the seashore sand, and Rama worshipped it. This came to be known as the Ramalingam. When Hanuman later arrived with the lingam from Kailash — called the Vishwalingam — Rama instructed that it too be honoured in the main sanctum.
The temple built to commemorate this event, Ramanathaswamy Temple, is today regarded as one of India's four sacred Char Dham sites and one of the twelve Jyotirlingas — a rare confluence of both Vaishnava and Shaiva traditions. The temple's 1,212-metre-long corridor is recognised as the longest temple corridor in the world.