Two brothers behaved like "drunken louts" when they attacked a man outside a Cardiff mosque while worshippers were inside marking the end of Ramadan.
Luke Thomas, 20, stabbed the victim who was guarding the entrance of Dar Ul Isra mosque, but Newport Crown Court heard it was not racially motivated.
He was jailed for five years after he admitted unlawful wounding and possession of a knife.
Liam Thomas, 18, was given an 18-month suspended sentence for affray.
The court heard that at just after 01:00 BST on 2 June the heavily drunk brothers cycled past the mosque in the Cathays area of Cardiff before getting off and running at two men outside the entrance.
Thomas Stanway, prosecuting, said: "Luke Thomas was in possession of a six inch Rambo-style knife shouting, 'come on'. The defendants attacked the men on the door and others who came to help.
One of the brothers was heard to shout, "you're going to get what's coming to you".
CCTV footage showed members of the mosque coming out and throwing chairs at their attackers to try to make them leave.
Liam Thomas was held by worshippers members of the mosque in an alleyway, and another restrained his brother.
When Luke Thomas was let go the man holding him found he had been stabbed in his torso and had a long scratch down his leg.
Judge Nicola Jones said she was "not sentencing on the basis of a religiously or racially-motivated offence - it was the behaviour of drunken louts".
However, she said the attack "took place outside a place of worship on one of the most holy days for that religion".