Pennsylvania GOP Rep. Tim Murphy has resigned from Congress amid revelations of an extramarital affair where he reportedly asked his mistress to get an abortion.

House Speaker Paul Ryan said he received Murphy’s resignation letter Thursday afternoon.

“It was Dr. Murphy's decision to move on to the next chapter of his life, and I support it,” Ryan said. “We thank him 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.”

A local newspaper published text messages this week indicating that the congressman, who opposes abortion, asked his mistress to get an abortion when he thought she was pregnant. It turned out she wasn't.

Murphy voted in favor of a bill earlier this week to ban abortions after 20 weeks.

PRO-LIFE CONGRESSMAN REPORTEDLY ASKED GIRLFRIEND TO GET AN ABORTION

On Wednesday, Murphy announced plans to retire at the end of this term, saying he will "take personal time to seek help as my family and I continue to work through our personal difficulties."

Murphy had recently acknowledged his affair with Shannon Edwards, which became public as a result of her divorce proceedings.

The resignation leaves the GOP-controlled House with two vacancies, but Republicans expressed confidence they would hold onto Murphy’s seat, which is in a safe Republican district.

“As I said last night, the circumstances surrounding this situation are extremely disappointing to me,” said National Republican Congressional Campaign Chairman Steve Stivers.

Stivers added: “However, the NRCC is undefeated in special elections this year and I’m supremely confident that will continue.”

Fox News' Chad Pergram and The Associated Press contributed to this report.