Australia went to the polls on 7 September, in an election that just a few months ago was considered a formality for the leader of the opposition, Tony Abbott.

However, the ousting in June of Prime Minister Julia Gillard from the ruling Labor Party and the return of former Prime Minister Kevin Rudd reinvigorated the campaign.

While Mr Abbott had a clear lead in pre-June polls, Mr Rudd has pulled his party back into contention. But Labor remained some way behind and ultimately lost to Mr Abbott's Liberal-National coalition.

Here is a brief guide to the election.

Parliament

Australia's parliamentary system is somewhere between that of the UK and the US, with a lower and upper house - the House of Representatives and the Senate respectively.

The prime minister and the members of his or her government sit in the lower house. To command a majority, they must hold more than half of the 150 seats.

In terms of electoral system, the system is similar to that used in the US.

The number of MPs for each state represented in the House of Representatives is determined by the population of the state. The more people who live in a state, the more MPs it has.

The number of senators is fixed, with 12 senators for each of the six larger states and two each for the less populous Northern Territory and the Australian Capital Territory.

Main candidates

Image caption Kevin Rudd set the agenda with several major policy announcements

Kevin Rudd

In early 2010, opinion polls suggested that, as leader of the Labor Party, Kevin Rudd was Australia's most popular prime minister for three decades.

But controversies over a shelved emissions trading scheme and an unpopular mining tax caused his support to fall - and his Labor party moved against him. His deputy, Julia Gillard, challenged him for the leadership and won.

The move, however, sparked a public backlash. Out of office, Mr Rudd remained a thorn in the side of Ms Gillard, consistently polling higher than her.

In June 2013, with an election looming and support for Labor plummeting, his backers called for a return to avoid defeat. Mr Rudd won a leadership challenge and returned to lead his party into the vote.

Read a full profile of Kevin Rudd

Image caption Tony Abbott's straight-talking style has earned him the nickname "Tear-down Tony"

Tony Abbott

Mr Abbott, a straight-talking former Rhodes Scholar who once wanted to be a monk, took over a flagging Liberal-National coalition in December 2009.

A polarising figure, especially at the start of his leadership, Liberal Party leader Mr Abbott attracted early criticism for gaffes and was called a misogynist by former Labor Prime Minister Julia Gillard.

But, amid bitter Labor infighting, he has transformed his image in the eyes of many from that of a pugnacious politician to a leader-in-waiting.

Read a full profile of Tony Abbott

Other Parties

Green Party

The Greens won their first seat in the House of Representatives at the last election.

Despite their small size they have a significant role in Australian politics and had been working with the Labor Party and independent MPs in government, after the last election produced a hung parliament.

However, in February 2013, the Greens announced the end of this partnership because of what it termed backtracking by Labor on a mining tax.

National Party

The National Party, commonly referred to as the Nationals, has a long-standing partnership with the Liberal Party - often referred to simply as "the coalition".

With its anti-environmentalist, pro-mining reputation, the party tends to draw its support from rural areas, though it remains more strongly represented at a regional level than in the national parliament.

Warren Truss, the party's leader, was expected to become deputy prime minister in the event of a Liberal-National coalition win.

Voting

The House of Representatives has 150 seats and all of them were up for election. The MPs are selected using a preferential voting system.

Australia is one of the few countries with mandatory voting laws and failure to cast a vote can result in a fine of A$20 (about $18; £12).

Preferential voting system

Instead of putting an "X" next to their choice, the voter writes a number next to the candidates on the ballot paper to indicate their preference.

The first choice on the ballot is known as the "primary vote'.

When the ballots are counted, if no candidate has won more than 50% of the votes, then the person with the lowest vote is excluded.

The votes for the eliminated candidate are re-counted and then awarded to the next preference on each ballot.

The elimination of candidates and re-counting of ballots continues until a candidate wins enough preferred votes to pass the 50% mark.

Major issues

Economy

Australia experienced a fairly robust recovery after the worldwide recession. In 2013 it reported growth of 2.5%, inflation holding at 2.4%. Unemployment has been steadily growing but still remains at a relatively low 5.7% of the working population.

Some economists have expressed concerns about the large deficit of about A$30bn (£17.5bn) that has continued to grow despite the relative strength of the economy.

The parties are split on how to tackle this deficit. The Labor Party has pledged to start new spending programmes to boost growth and thus increase the government's income, while Tony Abbott for the coalition has a plan to repeal taxes and cut spending.

Read Jon Donnison on why Australians are worried about the economy.

Immigration

The issues of asylum and border protection have been heavily debated. Both parties pledged to reduce the number of people arriving by boat to Australia, though promoted different policies.

Mr Rudd suggested a A$1.1bn (£640m) programme that would settle asylum seekers outside Australia - dubbed the Papua New Guinea plan.

Tony Abbott said that he would delegate the problem to the military, who would tow asylum-seeker boats to Indonesia. Indonesia is opposed to this plan.

Read Jon Donnison on Australia's asylum debate.