Theresa May, the former British prime minister whose time in Downing Street was scarred by a protracted battle over Brexit, is to leave Parliament at the next general election after 27 years as a lawmaker.

With the Conservative Party trailing badly in opinion polls before an election that many analysts expect it to lose, Mrs. May is the most senior of the approximately 60 lawmakers from the party who have so far announced plans to leave Parliament.

Mrs. May, Britain’s second female prime minister, said in a statement to her local newspaper that she had “taken the difficult decision” to stand aside because she no longer felt she could represent voters in her district of Maidenhead in the way they deserved.

Causes that she has championed since leaving Downing Street, including tackling modern slavery, were taking an “increasing amount” of her time, she said.

Mrs. May became prime minister in 2016 after her predecessor, David Cameron, resigned when he found himself on the losing side of a referendum in which people in Britain voted, by 52 percent to 48 percent, to leave the European Union.

After that result, which sent shock waves around the world, it fell to Mrs. May — who had opposed the British withdrawal — to negotiate an exit deal with the bloc. In the divisive aftermath of the vote, her Brexit plan failed to win support in a deeply divided Parliament, and the deadlock that ensued provoked a protracted political crisis.