Srimad Bhagavatam Canto 09, Chapter 14, Text 06

SB 9.14.6

sukro brhaspater dvesad
 agrahit sasurodupam
haro guru-sutam snehat
 sarva-bhuta-ganavrtah
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
Because of enmity between Brhaspati and Sukra, Sukra took the side of the moon-god and was joined by the demons. But Lord Siva, because of affection for the son of his spiritual master, joined the side of Brhaspati and was accompanied by all the ghosts and hobgoblins.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The moon-god is one of the demigods, but to fight against the other demigods he took the assistance of the demons. Sukra, being an enemy of Brhaspati, also joined the moon-god to retaliate in wrath against Brhaspati. To counteract this situation, Lord Siva, who was affectionate toward Brhaspati, joined Brhaspati. The father of Brhaspati was Angira, from whom Lord Siva had received knowledge. Therefore Lord Siva had some affection for Brhaspati and joined his side in this fight. Sridhara Svami remarks, angirasah sakasat prapta-vidyo hara iti prasiddhah: “Lord Siva is well known to have received knowledge from Angira.”
Srimad Bhagavatam Canto 09, Chapter 14, Text 05
Srimad Bhagavatam Canto 09, Chapter 14, Text 07