A man who was allegedly held against his bed by four bearded attackers while he was whipped with a cord in Sydney's west has said he was the victim of sharia.

The 31-year-old man said he was a recent convert to Wahhabism and had been punished by members of his congregation for drinking.

Police would not confirm whether the alleged attack in a unit in Melton Street, Silverwater, was thought to involve sharia.

The man was lashed 40 times during the alleged assault, which is said to have lasted for 30 minutes in the early hours of Sunday morning.

The men left the flat after the alleged lashing and the man called police.