 According to tradition , the mosque stands on the site of the Philistine temple dedicated to Dagon — the god of fertility — which Samson toppled in the Book of Judges . Later , a temple dedicated to Marnas — god of rain and grain — was erected . Local legend today claims that Samson is buried under the present mosque . 
