Mahmud smashed the infidels' idols and destroyed their temples as he went, but was nonetheless cultured enough to use the booty to build a library, a museum, and a splendid mosque when he got back to Ghazni.
Mahmud looted the heretical temples of his enemies and funded the construction of a mosque.