Locke stood as a Green Party candidate in the
1999 election and was elected as a list MP, ranked seventh on the
party list. Locke's election as the final Green list MP, at the expense of Labour, deprived the
Labour–Alliance government of a majority but the Green Party agreed to provide
confidence and supply to the government. Locke was returned to Parliament as a list MP in the
2002,
2005 and
2008 elections. In the latter three elections, he stood unsuccessfully in the
Epsom electorate. Through his twelve-year parliamentary career, Locke was the Green Party spokesperson for foreign affairs, defence, immigration and disarmament, and a member of the foreign affairs, defence and trade committee. He was also a Green Party spokesperson for state services, police, security, human rights, and Auckland transport. It was defeated at its first reading. The second, the International Treaties Bill, attempted to give greater parliamentary oversight of treaty-making. It was sent to select committee, but ultimately defeated at its second reading in 2003. As a Member of Parliament, Locke established a profile of being an "unofficial civil liberties watchdog". which he argued breached human rights principles. He also opposed New Zealand's commitment of special forces to the war in Afghanistan. Long a critic of New Zealand's intelligence services, in 2008, Locke received, under the
Privacy Act, a copy of the file the
Security Intelligence Service had kept on him from 1955, when he had been 11 years old, to 2006. Locke supported a
New Zealand republic. In his maiden speech, Locke stated "We should also break free of the British Crown and become a republic. The question is not whether the monarchy has a lot of power over us. In practice it doesn't. The problem is that bowing before the British Queen reflects a colonial mentality." In 2002, Locke put forward the Head of State (Referenda) Bill, which if passed would have brought about a referendum on the question of whether New Zealand should become a republic. The Bill was selected for debate on 14 October 2009 but was defeated at its first reading in April 2010. In January 2011, Locke announced that he would retire at that year's election. He delivered his valedictory speech on 28 September 2011. With
Sue Kedgley, Locke's retirement completed the departure of the first intake of Green Party MPs from 1999. ==Honours and awards==