Opposition member
Gillard was elected as Member for Lalor, a safe Labor seat near Melbourne, in the House of Representatives at the 1998 election, replacing Barry Jones, who had retired. She made her first speech to the house on 11 November 1998.
Shadow Minister for Population and Immigration: 2001–2003
After Labor's defeat at the 2001 election, Gillard was elected to the shadow cabinet, with the portfolio of population and immigration. In February 2003, she was given the additional portfolios of reconciliation and Indigenous affairs.
In the wake of the Tampa and Children Overboard affairs, which were partly credited with Labor's 2001 election loss, Gillard developed a new immigration policy for the Labor Party.
Shadow Minister for Health: 2003–06
Gillard was promoted to the position of Shadow Health Minister in July 2003. Shortly after this, the government moved Workplace Relations Minister Tony Abbott to the health portfolio. The rivalry between Abbott and Gillard often attracted attention from the media. She gained additional responsibility for managing opposition business in the House of Representatives.
In the aftermath of the Labor loss at the October 2004 election, it was speculated that Gillard might challenge Jenny Macklin for the deputy leadership, but she did not do so.
Gillard had been spoken of as a potential future leader of the party for some years but, until 2005, she stayed out of leadership contests. After Mark Latham resigned as leader in January 2005, however, she emerged as a possible successor along with Kim Beazley and Kevin Rudd.
After appearing on the ABC's Australian Story program in March 2006, an Ipsos Mackay poll in April 2006, conducted for Network Ten's Meet the Press program, found that respondents would prefer Gillard to be Labor leader. She polled 32% compared with Beazley's 25% and Kevin Rudd's 18%.
Although she had significant cross-factional support, she announced on 25 January 2005 that she would not contest the leadership, allowing Beazley to be elected unopposed.