Jalal Uddin was attacked in a children's play area in Rochdale, near Manchester, on the evening of February 18 this year.
The imam was targeted after he left the mosque where he usually prayed, ate a meal at a friend's house and then walked home, Manchester Crown Court heard.
"Mohammed Hussain Syeedy, the defendant, and an associate of his named Mohammed Abdul Kadir were supporters of ISIS and so they subscribed to the view that those who practised Ruqya (Islamic healing) deserved such punishment," Prosecutor Paul Greaney said.
Syeedy and Kadir, both in their early 20s, are believed to have murdered Uddin with a hammer after stalking him for months, the court was told at an ongoing trial this week.
More From This Section
"These injuries were plainly not the result of a robbery gone wrong. On the contrary, they were obviously the result of an attack that was planned -- why else did the killer have a hammer with him in a children's park? -- motivated by hatred and by a desire to humiliate Jalal Uddin and undoubtedly intended to kill or, at the very least, cause really serious harm," Greaney said.
Jurors were told that Syeedy accepts that Kadir murdered Uddin and that he was with his accomplice, before and after the killing.
The case continues and is expected to conclude next month.