Sunak was elected to the House of Commons for Richmond in North Yorkshire at the 2015 general election, succeeding William Hague. Sunak supported Brexit in the 2016 referendum on EU membership. He was appointed to Theresa May's second government as Parliamentary Under-Secretary of State for Local Government in the 2018 reshuffle. He voted three times in favor of May's Brexit withdrawal agreement. After May resigned, Sunak supported Boris Johnson's campaign to become Conservative leader. After Johnson became Prime Minister, Sunak was appointed Chief Secretary to the Treasury. Sunak replaced Sajid Javid as Chancellor of the Exchequer after Javid's resignation in the February 2020 cabinet reshuffle. As Chancellor, Sunak was prominent in the government's financial response to the COVID-19 pandemic and its economic impact, including the Coronavirus Job Retention and Eat Out to Help Out schemes. He resigned as chancellor in July 2022, followed by Johnson's resignation amid a government crisis. Sunak stood in the Conservative party leadership election to replace Johnson and lost the members' vote to Liz Truss.
After Truss'sresignation amid another government crisis, Sunak was elected unopposed as Leader of the Conservative Party. He was appointed Prime Minister on 25 October 2022, becoming the first British Asian and Hindu to hold that position.