Australia’s ruling coalition suffered a “catastrophic” loss in a crucial by-election on Saturday that has left prime minister Scott Morrison without a parliamentary majority.

In a stunning result that looms as the worst swing against a government in Australian history, an independent candidate, Dr Kerryn Phelps, won a comfortable victory against her Liberal opponent, Dave Sharma, in the Sydney seat of Wentworth.

It was the first time the Liberals have lost the conservative-leaning seat since the party was formed more than 70 years ago.

With 54 per cent of the vote counted, Dr Phelps, a prominent doctor and gay rights campaigner, had an unassailable lead over Mr Sharma, a former ambassador to Israel, of 54 per cent to 46 per cent.

Declaring victory, Dr Phelps said the contest had been a “David and Goliath struggle”.

“This win tonight should signal a return of decency, integrity and humanity to the Australian parliament,” she said.