Four men have been found guilty of assault after a Muslim convert was whipped as punishment under sharia law for drinking alcohol and taking drugs.

It is the first time a case like this has come before the Australian courts.

Four men broke into Christian Martinez's Silverwater unit in Sydney's west in 2011 and whipped him 40 times with an electrical cord in the name of religious law.

Mr Martinez was a recent convert to Islam.

The day before the attack he had drunk alcohol and taken drugs and had called his religious mentor, Wassam Faayad, to confess.

Mr Martinez had consented to the punishment but during the whipping he cried for it to stop.

Fayed carried out the whipping while the three others held Martinez down.

The judge ruled Mr Martinez had withdrawn his consent and it was not properly informed consent in the first place.

All four men have been found guilty of assault occasioning actual bodily harm in company.

They will be sentenced at a later date.