By Richard Cowan and Susan Cornwell

WASHINGTON (Reuters) - U.S. House of Representatives Speaker Paul Ryan will not seek re-election and will leave his post at the start of 2019, dealing a blow to fellow Republicans and President Donald Trump ahead of fast-approaching congressional elections.

By triggering a House leadership struggle when the party should focus on defending its congressional majorities and advancing Trump's agenda, Ryan dismayed some Republicans already concerned about their prospects with U.S. voters in November.

“It’s going to set off an intramural war among Republicans on who is going to be the next speaker. It will take the eye off the ball of keeping a majority in the House,” said one Republican veteran who asked not to be identified.

Trump's 2018 agenda, including construction of a U.S.-Mexico border wall and an infrastructure proposal, has gained little traction. Ryan's departure will not likely improve the outlook, said John Feehery, a Republican lobbyist who worked as spokesman for former House Speaker Dennis Hastert.

"Realistically, the chances were low of anything getting done anyway,” Feehery said.

The Republicans' biggest policy win since Trump took office almost 15 months ago has been the tax overhaul approved in December, an achievement in which Ryan played a major role despite his sometimes strained relationship with the volatile president.

Asked how much Trump and his conduct influenced his decision not to seek re-election for his seat representing a district in southeastern Wisconsin, Ryan told reporters: "Not at all."

Politico later quoted Ryan as saying in an interview that he had a good rapport with Trump, but wished the president tweeted less. "It works better to have private conversations than public disputes," Ryan said.

Ryan's announcement was the latest upheaval in Washington in Trump's second year as president, after the resignations and firings of numerous White House officials and Cabinet members.

Story continues

In 2016, Trump slammed Ryan as a "very weak and ineffective leader." On Wednesday, Trump wrote on Twitter: "Speaker Paul Ryan is a truly good man, and while he will not be seeking re-election, he will leave a legacy of achievement that nobody can question. We are with you Paul!"

Ryan, who was the Republican vice presidential nominee in 2012, poured cold water on speculation he could be eyeing a presidential campaign in 2020 or beyond.

"I’m not going to run for president. That’s not my plan," he said on CNN.

Ryan was scheduled to dine with Trump and other Republican congressional leaders on Wednesday evening at the White House.

CITES TAX OVERHAUL

Ryan became speaker in 2015 after fellow Republican John Boehner quit amid clashes with right-wing Republicans.

While Ryan cultivated a reputation as a fiscal conservative, the December 2017 tax law and later federal spending deals he helped negotiate will help rack up $11.7 trillion in federal deficits over the next decade, according to recent estimates by the non-partisan Congressional Budget Office.

Among names circulating as a possible Ryan replacement were House Majority Leader Kevin McCarthy of California and House Majority Whip Steve Scalise of Louisiana, who was wounded by a gunman last year. The two are expected to wage a furious effort to raise campaign funds for fellow House Republicans to shore up support for their potential leadership aspirations.

Mark Meadows, who heads the conservative House Freedom Caucus that helped prompt Boehner's departure, told reporters the top House Republican job was not on his list of goals.

Although not on a par with Ryan, both McCarthy and Scalise are strong campaign fundraisers, a crucial talent in any contest for congressional leadership in both parties.

Stanley Hubbard, a billionaire Republican donor who owns the radio company Hubbard Broadcasting, said fundraising skill "absolutely" would be a key to choosing the next speaker.

McCarthy raised $8.75 million in the first quarter of 2018, sending $2.9 million of that to the National Republican Campaign Committee, which helps fund Republicans' campaigns.

Scalise has not yet made public his fundraising totals for the first three months of the year. Ryan brought in $11 million in the first quarter.

"Ryan's retirement wasn't a huge shock to the political establishment and he leaves behind two prolific fundraisers in Scalise and McCarthy," said Joe Brettell, a Texas-based Republican strategist.

TRUMP AND RYAN

Ryan was criticized by Democrats for what they saw as his failure to stand up to Trump over his attacks on U.S. law enforcement and his alienation of U.S. allies.

In 2016, Ryan hesitated to endorse Trump after it became clear the wealthy New York real estate developer would become the party's presidential nominee, but eventually did so.

Ryan voiced unease at candidate Trump's call for banning Muslims from entering the United States and his criticism of a Mexican-American U.S. judge. A month before the 2016 election, Ryan said he was "sickened" by Trump's remarks about groping women captured on a 2005 audiotape.

After Trump won the presidency in November 2016, Ryan's words softened as he expressed annoyance at being asked to respond to the president's incendiary Twitter messages, but rarely offered direct criticism.

In stepping down, Ryan may have boosted Democratic prospects in November. Democrats need to pick up at least 23 seats in the 435-member House to regain the majority.

Another Republican House member, Dennis Ross of Florida, said on Friday he would not seek re-election. Forty-five House Republicans now have either resigned or announced plans not to seek re-election, compared with 20 Democrats.

(Reporting by Richard Cowan and Susan Cornwell; Additional reporting by Steve Holland, Ginger Gibson, Doina Chiacu, Susan Heavey; Editing by Kevin Drawbaugh and Peter Cooney)