Paul Ryan never intended to fight Donald Trump for control of the Republican Party.

Months before the New York celebrity businessman emerged as the front-runner for the GOP nomination, the House speaker anticipated the chance the presidential contest that might leave the party fractured and aimless. According to aides, Ryan decided to take preemptive action. House Republicans would try to chart their own course, independent of their eventual presidential nominee — on policy, defining what the party stands for, and how they communicate with voters.

But as Trump inches closer to the nomination, he and Ryan are increasingly competing for dominance over the party. Neither is backing down.

Last week, Ryan delivered what he billed a major speech on the "state of American politics." The speaker promoted an inclusive, conservative approach to governing widely interpreted as a direct rebuke of Trump's brash, big-government populism. This week, Trump is heading to Janesville, Wis., Ryan's hometown, for a campaign rally.

"I don't think Paul woke up one day and said, 'I have to do something about Trump.' It's more about trying to shape how the public sees us," a House Republican told the Washington Examiner. "I think the Trump factor just makes it a little more serious, the consequences more dire, than we thought they might be originally."

The House is on recess next week, but Ryan will be traveling on political business and won't be home in Janesville when Trump visits Tuesday. The Trump campaign did not reach out to the speaker's team prior to scheduling the rally, sources say. Trump is headed to Wisconsin to stump for votes ahead of the state's April 5 GOP primary.

Ryan, the Republican vice presidential nominee in 2012, was elected speaker last October. He since launched an "agenda project," a collection of policy proposals House Republicans plan to unveil by the start of July's Republican nominating convention in Cleveland. Ryan has delivered a series of speeches on the topic of political leadership and the role the Republican Party should play in the national discourse.

Already, there are areas of friction between House Republicans, led by Ryan, 46, technically the top Republican in Congress, and Trump, 69, who as the nominee would be the titular head of the party.

The speaker and his members support what they call reform of entitlement programs like Medicare and Social Security. Trump opposes cutting the programs and has argued Ryan's proposal to partially privatize Medicare helped cost the GOP the 2012 election. Ryan and his caucus generally embrace an interventionist American foreign policy. Critics call Trump a quasi-isolationist. Ryan has condemned Trump for, among other things, proposing to ban all Muslims from entering the United States. Trump has said that he and Ryan would get along fine, as long as the speaker doesn't oppose him.

Ryan's allies downplay the his budding war with Trump.

They say Ryan has been a reformer since arriving on Capitol Hill in 1999, often in the face of opposition from GOP leadership in Congress and the White House. House Republicans, they note, are on the ballot in November too. Ryan and his members have to be able to tell the voters what they stand for and how they would govern with another two years in the majority, especially if Republicans don't win the White House.

"It's authentic Paul Ryan," said Rep. Kevin Brady of Texas, who succeeded the speaker as Ways and Means Committee chairman. "He's been pushing the envelope on a bold Republican vision for a long time."

Rep. Tom Price, the Georgia Republican who followed Ryan as Budget Committee chairman, said the speaker's strategy is less an attempt to create "a contrast with any presidential candidate" than it is seizing the mantle of leadership. "He and I have talked about for years about the importance of having the House be the idea-generation factory."

Privately, House Republicans concede that Trump is a factor in Ryan's approach now, even if the presidential candidate wasn't the primary motivation behind the speaker's game plan months ago.

House Republicans are concerned about Trump's impact on their re-election prospects. Recent public polling suggests that the real estate mogul and reality television star would lose to Democratic front-runner Hillary Clinton, likely dragging congressional Republicans down with him. Even if Trump wins, there's no guarantee that he would embrace Republican-style conservatism if it is at odds with his nationalist agenda.

Efforts by members of Congress to separate themselves from an unpopular presidential nominee have a history of failing far more than they suceed. But if Ryan's actions allow House Republicans to distance themselves from Trump, the "agenda project" and the speaker's periodic admonishments of the billionaire's controversial rhetoric are viewed as an insurance policy. It has provided a sense of relief to members anxious about the election and the future of the party.

"In the last couple of days, Ryan has gotten even more aggressive in creating a separation story," a GOP operative with ties to the House said on Friday. "I think that's where his members are."

Trump holds leads Sen. Ted Cruz of Texas in the nomination fight. His advantage over Gov. John Kasich of Ohio is even larger. But Cruz has a chance to block Trump from winning the 1,237 delegates he needs to win the primary and avoid a contested convention.

That complicates Ryan's ability to explicitly criticize Trump, something he has nonetheless done from time to time. The top House Republican — in this case, Ryan — serves as the presiding officer of GOP's quadrennial nominating convention. Ryan going further than he already has in pushing back against Trump, either by further denunciations or outright opposition, could be viewed as a conflict of interest and prove counterproductive.

The speaker dismisses any suggestion that he is acting to undermine Trump.

"Speaker Ryan and House Republicans are working to provide the American people a clear picture of the conservative solutions needed to restore a confident America. The House is uniquely situated to serve as this kind of ideas factory," Ryan spokesman AshLee Strong said.