Speaker Paul Ryan (R-Wis.) is retiring at the end of this Congress, ending his speakership a little more than three years after it began and as the GOP faces a possible loss of its majority this fall.

Ryan said during a news conference that he will serve out his term and retire from Congress in January.

"If I am here for one more term my kids will only have ever known me as a weekend dad. I just can't let that happen. So I will be setting new priorities in my life," Ryan said.

Ryan also touted the GOP tax cuts passed in December as his top accomplishment as Speaker.

"The two biggest achievements for me are first, the major reform of our tax code for the first time in 36 years ... Second, something I got much, much more invested on since becoming Speaker, is to rebuild our nation's military," he said.

Ryan told House Republicans of his decision at a conference meeting on Wednesday morning in the Capitol's basement. Ryan told colleagues that he came to Congress single and now has three teenagers who have only known him as a "weekend dad" their entire lives.

He said he would "run through the tape" and work hard until his term ends in January. But he added that he wanted to spend more time with his family.

He received several standing ovations. But the mood was solemn and some lawmakers shed tears, according to those in the room. Sources said top staff members in Ryan's office only learned of the decision Tuesday night.

Rumors have been swirling for months that Ryan could step down at the end of this Congress, but a formal announcement was not expected before Election Day given the negative signal the retirement would send for GOP hopes of keeping the House majority.

The move could strike a blow to GOP fundraising efforts in the lower chamber, pushing more money away from House candidates and toward the Senate, where the GOP has a better shot of keeping its majority.

Democrats need to gain 23 seats to win back the majority, a goal that appears within reach.

Axios first reported the news of Ryan's pending retirement.

President Trump hailed Ryan as a "truly good man" in a tweet about his retirement. The president said Ryan would "leave a legacy of achievement that nobody can question."

Ryan's decision will also trigger a leadership race that had already started amid the speculation that this could be his final year as Speaker.

House Majority Leader Kevin McCarthy (R-Calif.) and House Majority Whip Steve Scalise (R-La.) are both seen as potential Speakers-in-waiting - or minority leaders if Republicans lose the House majority.

McCarthy's support for a rescission package that would claw back spending from the recently approved $1.3 trillion omnibus government funding package led to talk that he was taking steps toward a speakership run.

The majority leader's close relationship with Trump has also been seen as a potential boon for him in a race against Scalise.

The whip's political stock has grown since he survived a shooting at a congressional baseball practice last summer that left him critically injured.

Scalise's return to Congress inspired members on both sides of the aisle and raised his profile nationally.

Meadows predicted that the race to replace Ryan will be settled before the midterm elections.

"I think who the next Speaker will be, will certainly be decided before November," Meadows told reporters. "Not in fact, but probably in practicality."

Ryan, 48, became Speaker in 2015 after former Speaker John Boehner's (R-Ohio) retirement. He was a consensus choice after McCarthy dropped a bid for the speakership.

"He was a great member, a great Speaker," said House Small Business Committee Chairman Steve Chabot (R-Ohio), who has served nearly two decades with Ryan. "It is a loss, but there are a lot of great members here and we'll move on."

Ryan served as the GOP's vice presidential candidate in 2012, and was previously a chairman of the House Ways and Means and Budget committees.

He was known as an advocate for cutting taxes, reforming entitlements and curbing spending.

As Speaker, he won a significant victory in December with the passage of a tax-reform bill.

On spending, passage of the $1.3 trillion omnibus last month upset many House conservatives, who saw the package as a betrayal of GOP principles to reduce spending.

Ryan's backing for the measure, and the decision to move the bill to the floor quickly after its public release, was sure to cost him support from some conservatives in a leadership contest.

Republican colleagues acknowledged that some conservatives would celebrate Ryan's departure. But those colleagues said Ryan has proven to be an unrivaled fundraiser and tremendous leader.

"There will be a number of Republicans who probably will be happy. There are many in the base who feel that Paul Ryan is part of the problem," Rep. Rodney Davis (R-Ill.), chairman of the Republican Main Street Caucus and a Ryan ally, told The Hill. "I always try to educate how important quiet leadership from people like Paul Ryan has been."

"In the end, I think Paul will continue to do what he's been doing in raising historic amounts of money to help us keep the majority," he added. "How can we even talk about the Speaker's race until we know if we'll have the majority in November?"

Senate Majority Leader Mitch McConnell (R-Ky.) lauded Ryan from the Senate floor, praising his work on the GOP tax plan.

"On its own, this generational accomplishment would secure the Speaker's legacy as a transformational conservative leader. But of course, it is far from the only fruit of his speakership," McConnell said.

He added that he is "glad we can count on his continued leadership through the rest of this year" and "I look forward to collaborating closely these next months."

Updated: 10:51 a.m.