At the
1997 general election, Gray was elected to the
House of Commons as
Member for the
North Wiltshire constituency, following the retirement of the former Conservative Member,
the Earl of Kilmorey. Gray won the seat with a majority of 3,475. Gray made his
maiden speech on 11 June 1997, in which he spoke of his constituency's largest town of
Chippenham, and of his sadness at the
massacre in his childhood home town of
Dunblane. His shadow ministerial career began with his appointment as a Conservative Whip in October 2000 and then as a Shadow Minister for Defence in 2001. He served as Shadow Minister for the Countryside from 2002 to 2005. After the
2005 general election, he served for just one week as
Shadow Secretary of State for Scotland, as
Peter Duncan had lost his seat. He sat on the Environment, Transport and Regional Affairs Committee from 1997 to 2001. He served from 2001 to 2003 on the Broadcasting Committee. He was a member of the
Environment, Food and Rural Affairs Committee for the 2005 Parliament, and Chairman of the Conservative Rural Action Group (2002–2005). Gray founded the All Party Group for the Army in 2004 and was the sitting MP on
David Cameron's policy group for National and International Security, chaired by
Dame Pauline Neville-Jones (2006–07). The Group published their report, An Unquiet World in July 2007. In March 2009, Gray was a member of a cross-party parliamentary delegation to
Afghanistan to learn about
British Army operations there. During the visit, British service personnel demonstrated the process by which wounded soldiers are flown into Kandahar on a
Hercules and transferred across the runway to a C-17 equipped with the latest medical equipment, and were photographed with medical staff on board. Gray denied allegations that he had taken photographs of a "dying soldier" posted on the blog of
Iain Dale, stating that after a reminder to delete any images including injured servicemen, he had checked his camera and found none. According to Gray it was night time and the delegation was kept 500 yards away from the injured soldiers. At the 2010 General Election, Gray had stood in the constituency of
North Wiltshire: he won by a majority of 7,483 votes, winning 25,114 votes and securing 51.6% of the 48,699 who voted. The number of votes he received had risen by 1.9% since the last election, whilst support for the Labour Party had fallen by 5.3% in his constituency. In the 2010 Parliament he sat on the Procedure Committee, Panel of Chairs and until 2013 the Finance and Services Committee. From 2013 onwards he sat on the Defence Committee and Committees on Arms Export Controls. In May 2014 he was one of seven unsuccessful candidates for the
chairmanship of the
House of Commons Defence Select Committee. Gray has signed several
early day motions, sponsored by Conservative MP
David Tredinnick, in support of the continued funding of
homeopathy on the
NHS. Gray campaigned against the closure of
RAF Lyneham. In January, he hosted a special 1½ hour Westminster Hall debate on the subject of 'The RAF Air Transport Fleet and RAF Lyneham'. Following the debate, Gray published a dossier on a number of significant changes in the Air Transport Fleet which should, according to Gray, result in the decision to close RAF Lyneham being reversed. In a House of Commons debate on 9 December 2010,
Thomas Docherty, the
Labour Member of Parliament for
Dunfermline and West Fife accused Gray of directing a "racist remark" towards
Willie Bain. Gray was alleged to have told McBain to "get back to Jockland". Gray responded: "I cannot imagine what sedentary remark the hon. Gentleman may have heard, but I am certain that had it been out of order in any shape, size or form, Mr Speaker, who was then in the chair, would have picked me up on it. Further to that, as a Scot born, bred and educated, who never left the borders of Scotland until the age of 21, I think that unlike [Thomas Docherty], I have the highest respect and love for my native heath. I would never say a single word against it." In March 2019, Gray was one of 21 MPs who voted against LGBT inclusive sex and relationship education in English schools. A keen
Brexit supporter, he was an advocate for pro-Brexit lobby group
Leave Means Leave. In September 2021, he issued an apology after joking that a bomb should be delivered to the office of Labour Party chairwoman
Anneliese Dodds. Gray said: "It was a foolish remark. I meant no offence and hope none was taken." In October 2021, he was criticised after confusing Education Secretary
Nadhim Zahawi and Health Secretary
Sajid Javid at a reception in Parliament, allegedly saying "they all look the same to me." Gray acknowledged that he mixed up the names of the two ministers but denied saying "they all look the same to me".
Expenses : In May 2009, Gray's expenses were highlighted in the media when he was accused of claiming for Remembrance Day wreaths. It was claimed that his action had angered Forces charity groups. It was reported that Gray then complained to the
Leader of the House of Commons when he was told that
Remembrance Day wreaths were not a legitimate expense. These claims were denied by Gray who argued that Military and Council representatives do not pay for wreaths out of their own pockets. Details of Gray's expenses, published by House of Commons Authorities, show that he was never reimbursed for the cost of Remembrance Sunday wreaths. Gray was later criticised for claiming £2,000 decorating fees for a second home on the day he moved out. Gray organised three special surgeries in Corsham, Wootton Bassett and Malmesbury to answer any questions from his constituents regarding his expenses. ==Post-parliamentary career==