Australians could be forced to wait until the end of next week to find out who is in charge of their government after a knife-edge national election raised the prospect of a hung parliament, the prime minister said on Sunday.

The gamble by Prime Minister Malcolm Turnbull to call a rare early election may have failed, with his conservative Liberal Party-led coalition on track to lose a swathe of seats in the House of Representatives — and potentially control of the country.

Turnbull said he was pinning his hopes of maintaining a majority government on mail-in and early ballots that traditionally favor the conservatives.

"I remain quietly confident that a majority coalition government will be returned at this election when the counting is completed," Turnbull told reporters.

"While the count will take a number of days, probably until the end of next week, I can promise all Australians that we will dedicate our efforts to ensuring that the state of new parliament is resolved without division or rancor," he added.

The government was concerned that any perception of instability while the count was resolved could harm Australia's triple-A credit rating, he said.

Parties need to hold at least 76 seats in the 150-seat House of Representatives to form a government.

Opposition leader Bill Shorten did not speculate on a Labor victory, but celebrated the strong swing to his party just three years after it was convincingly dumped from power in the last election.

"What I'm very sure of is that whilst we don't know who the winner was, there's clearly one loser: Malcolm Turnbull's agenda for Australia and his efforts to cut Medicare," Shorten said on Sunday, referring to Australia's universal health care system.

Given the close result, just two possibilities remain: Turnbull's coalition will win by the slimmest of margins, or there will be a hung parliament.

Shorten and Turnbull said they had both contacted the five independent lawyers who could be called on to support a minority government.

Turnbull called the early election — dubbed a "double dissolution" because both the House and the Senate are dissolved — in a bid to break a legislative deadlock over a bill that would have created a construction industry watchdog. But the result of the election may bring further deadlock: If neither party earns a majority of seats in the House, both Labor and the coalition will be forced to try to forge alliances with independent lawmakers to form a minority government.

Hung parliaments are extremely rare in Australia, with only two since 1940. The most recent was in 2010, when then-Prime Minister Julia Gillard's ruling Labor Party was forced to secure an alliance with the minor Greens party and three independent lawmakers to form a fragile minority government. Three years later, the coalition swept to power after winning 90 seats.

Turnbull on Sunday did not directly say whether he considered calling new elections an option to resolve any deadlock.

"We are committed to ensuring that the parliament, as elected, will work effectively and constructively for the Australian people," Turnbull said.

The elections continue an extraordinarily volatile period in the nation's politics, where internal party squabbling and fears over sagging poll ratings have prompted five changes of prime minister in as many years.

That volatility is the new norm in modern politics, with many voters unwilling to commit to either major party, said Rodney Smith, professor of Australian politics at the University of Sydney. Behind that lack of commitment is the tendency of both the public and their politicians to focus more sharply on short-term rather long-term results.

"The speed of politics has definitely increased," Smith said. "We talk about the 24-hour news cycle and so on, and I think that's starting to make it difficult for parties in government to say, 'Well, you're not going to see any benefits from this policy for the next few years but it'll be good in the long term.'"

Opinion polls had predicted a close race, but had largely tipped the government to win by a narrow margin.

Monash University political analysts Nick Economou said Australia's new Senate could prove more resistant to free trade deals and globalization initiatives after two minor protectionist parties were among the winners at the election.

The Australian Electoral Commission said the Nick Xenophon Team party, which advocates protection of manufacturing jobs, and the anti-immigration Paul Hanson's One Nation party have likely won several seats.

Xenophon had been his party's lone senator for South Australia state. The party will now likely have three senators and a lawmaker in the House of Representatives. Hanson's party has had no representative in Parliament since she was voted out in 1998.

She and probably a second candidate from her party have won senate seats for Queensland state.

Going into the election, the government had 33 senators, Labor 25, the minor Greens party 10 and there were eight crossbenchers.

If the Labor and the Greens rejected legislation, the government needed the support of at least six of the crossbenchers to pass it.

Xenophon expects that if the government retains power, it would need the support of eight or nine crossbenchers to pass legislation against the will of Labor and the Greens.

The final makeup of the senate won't be known for weeks.

___

Associated Press writer Kristen Gelineau in Sydney contributed to this report.