By Colin Packham
SYDNEY, May 3 (Reuters) - Both major Australian parties lost candidates over social media gaffes on Friday ahead of this month's election as leaders locked horns in a debate in which a one-liner from the opposition leader earned him a narrow edge.
Prime Minister Scott Morrison forced a candidate to quit his Liberal Party over Islamophobic comments posted on social media, while a Labor candidate quit after old posts of off-color jokes emerged.
Jessica Whelan is the third Liberal candidate to be dropped by the party in the past week because of offensive social media posts. Morrison said her posts, which included one on genital mutilation, were at odds with the views of the Liberal Party, which rules in coalition with the National Party.
"Whether she's contrite about it... I won't have a candidate like that," Morrison told reporters in Victoria, where he was campaigning for the May 18 election. Whelan has said her posts were "inappropriate."
Labor's candidate for a seat in Melbourne, Luke Creasey, also quit his bid for office after The Australian newspaper published Facebook posts from 2012 in which he made light of rape.
"I think this is a really important lesson for young people that your social media footprint will follow you," Creasey said.
Analysts said the Liberals could suffer a backlash.
"There is a small fringe of the party that holds right-wing views. This will damage the party's standing in some parts of the country," said Peter Chen, professor of political science at the University of Sydney.
Polls have Morrison narrowly behind center-left Labor Party leader Bill Shorten, who also came out marginally on top in the debate in which he told Morrison to back out of his personal space.
After a slow-starting discussion that ranged over religion, health, suicide rates and climate change, it was during a set-to on tax policy that Morrison walked over, stood very close to Shorten on stage and challenged him to look him in the eye.
"You're a classic space invader," Shorten replied to laughter from the room at the Woolloongabba cricket ground in Brisbane.
"It was Shorten's moment really," said Rod Tiffen, a political analyst at the University of Sydney, adding it would likely feed into a perception that Morrison was "shouty" when cornered.
Voters at the debate, broadcast by Sky News, narrowly awarded Shorten victory, with 43 percent believing he won, compared to 41 percent favoring Morrison and 16 percent undecided.
Australia's most highly regarded opinion poll earlier this week showed the Liberal-National coalition had narrowed the gap on the center-left Labor party. (Reporting by Colin Packham and Tom Westbrook; Editing by Nick Macfie)