“I saw a man rushing to the checkpoint just outside the mosque,” Abdul Hussein, a worshipper at the mosque, said.
“I noticed his belt and shouted to my colleagues to stop the man. I also ran towards him but two colleagues ahead of me stopped the man,” he said.
The bomber then detonated his explosives, killing the men who tried to him, Hussein said.
In the second attack, eight people were killed when a bomber drove a car laden with explosives car into an Iraqi military armoured vehicle at a checkpoint in the southern district of Zafaraniya, the officials said.
Three soldiers were among those killed in the attack, with another 10 people injured.
In a separate attack, six people were killed on Thursday in a attack by gunmen in the province of Diyala, a region where some of the worst violence has been perpetrated.
The overall level of violence across Iraq has fallen in recent months, according to US military officials, but most of the country remains unstable.
The lastest attacks come a day after four people were killed and another 15 injured in a car bomb attack at a mosque in Balad, north of the capital Baghdad.