Rep. Tim Murphy (R-Pa.) announced his resignation from Congress Oct. 5, after a news report claimed Murphy asked a woman with whom he had an extramarital affair to get an abortion. (Elyse Samuels/The Washington Post)

Rep. Tim Murphy said Thursday that he will resign from Congress this month, a day after the eight-term Pennsylvania Republican announced that he would not seek reelection amid a personal scandal.

“Upon further discussion with my family, I have made the decision to resign my position” effective Oct. 21, Murphy wrote in a letter to House Speaker Paul D. Ryan. “I am grateful for the opportunity to have served the people of southwestern Pennsylvania and to have worked with the talented and dedicated men and women of the United States Congress.”

In a statement Thursday, Ryan (R-Wis.) thanked Murphy “for his many years of tireless work on mental health issues here in Congress and his service to the country as a naval reserve officer.”

Murphy’s decision to resign within weeks, rather than remain in Congress for an additional 15 months, came amid pressure from top Republican leaders to remove himself as a distraction as the GOP House tackles a major tax bill and other legislative priorities.

“I’ve spoken with Tim quite a bit the last couple of days,” Ryan said at a news conference shortly before Murphy’s resignation was announced. “I think it’s appropriate that he moves on to the next chapter of his life. And I think he agrees with that.”

An emailed request for comment sent to Murphy’s spokeswoman Thursday generated an automated reply that included Ryan’s statement on the resignation.

The resignation of Murphy, a clinical psychologist, comes after a news report claimed that the married Republican had asked a woman with whom he had an extramarital affair to get an abortion.

Murphy, 65, said in a statement Wednesday: “After discussions with my family and staff, I have come to the decision that I will not seek reelection to Congress at the end of my current term.”

Murphy first publicly admitted in early September to having an affair with Shannon Edwards, a woman half his age, a revelation that dealt a blow to his reelection prospects in 2018. Murphy was first elected to the House in November 2002.

In a Jan. 25 text message obtained by the Pittsburgh Post-Gazette, Edwards said Murphy had “zero issue posting your pro-life stance all over the place when you had no issue asking me to abort our unborn child just last week when we thought that was one of the options.”

According to the newspaper, a text response from Murphy’s cellphone number that same day said that his staff was responsible for the antiabortion messages: “I’ve never written them. Staff does them. I read them and winced. I told staff don’t write any more. I will.”

Murphy is a member of the House Pro-Life Caucus and was a co-sponsor of a Republican bill approved Tuesday that bans most abortions after 20 weeks of fetal development.

As a senior member of the House Energy and Commerce Committee and chairman of its oversight and investigations subcommittee, he helped write a major overhaul of mental health programs that was signed into law last year.

Murphy represents a district in Pennsylvania’s southwestern corner that is solidly Republican. The nonpartisan Cook Political Report rates it as having an 11-point GOP lean. The district voted for Donald Trump by 19 points over Hillary Clinton, 58 to 39, in the 2016 presidential election.

Murphy’s resignation sets up a special election that will be set at the discretion of Democratic Gov. Tom Wolf. Under Pennsylvania law, Wolf has 10 days once the seat is vacant to set the date of the election. The special election could ultimately coincide with the state’s May 15 primary.

National Republican Congressional Committee Chairman Steve Stivers said Thursday that “the circumstances surrounding this situation are extremely disappointing to me” but that the 18th Congressional District would remain in Republican hands.

“The NRCC is undefeated in special elections this year and I’m supremely confident that will continue,” he said.

Meredith Kelly, a spokeswoman for the Democratic Congressional Campaign Committee, said Murphy’s district “is a reliable Republican stronghold, but the grass-roots energy behind Democrats has proven powerful this year, and we will be closely tracking this district and special election.”

Mary Hui contributed to this report.