LANSING, Mich. — Dozens of heavily armed militiamen crowded into the Michigan Statehouse last April to protest a stay-at-home order by the Democratic governor to slow the pandemic. Chanting and stomping their feet, they halted legislative business, tried to force their way onto the floor and brandished rifles from the gallery over lawmakers below.

Initially, Republican leaders had some misgivings about their new allies. "The optics weren't good. Next time tell them not to bring guns," complained Mike Shirkey, the state Senate majority leader, according to one of the protest organizers. But Michigan's highest-ranking Republican came around after the planners threatened to return with weapons and "militia guys signing autographs and passing out blow-up AR-15s to the kiddies on the Capitol lawn."

"To his credit," Jason Howland, the organizer, wrote in a social media post, Shirkey agreed to help the cause and "spoke at our next event."

Following signals from President Donald Trump — who had tweeted "LIBERATE MICHIGAN!" after an earlier show of force in Lansing — Michigan's Republican Party last year welcomed the support of newly emboldened paramilitary groups and other vigilantes. Prominent party members formed bonds with militias or gave tacit approval to armed activists using intimidation in a series of rallies and confrontations around the state. That intrusion into the Statehouse now looks like a portent of the assault halfway across the country months later at the U.S. Capitol.

As the Senate on Tuesday begins the impeachment trial of Trump on charges of inciting the Jan. 6 Capitol rioting, what happened in Michigan helps explain how, under his influence, party leaders aligned themselves with a culture of militancy to pursue political goals.

Michigan has a long tradition of tolerating self-described private militias, which are unusually common in the state. But it is also a critical electoral battleground that draws close attention from top party leaders, and the Republican alliance with paramilitary groups shows how difficult it may be for the national party to extricate itself from the shadow of the former president and his appeal to this aggressive segment of its base.

"We knew there would be violence," Rep. Elissa Slotkin, D-Mich., said about the Jan. 6 assault. Endorsing tactics like militiamen with assault rifles frightening state lawmakers "normalizes violence," she told journalists last week, "and Michigan, unfortunately, has seen quite a bit of that."

Six Trump supporters from Michigan have been arrested in connection with the storming of the Capitol. One, a former Marine accused of beating a Capitol Police officer with a hockey stick, had previously joined armed militiamen in a protest organized by Michigan Republicans to try to disrupt ballot counting in Detroit.

The chief organizer of that protest, Meshawn Maddock, on Saturday was elected co-chair of the state Republican Party — one of four die-hard Trump loyalists who won top posts.

Maddock helped fill 19 buses to Washington for the Jan. 6 rally and defended the April armed intrusion into the Michigan Capitol. When Rep. Rashida Tlaib, D-Mich., suggested at the time that Black demonstrators would never be allowed to threaten legislators like that, Maddock wrote on Twitter, "Please show us the 'threat'?"

"Oh that's right you think anyone armed is threatening," she continued. "It's a right for a reason and the reason is YOU."

The lead organizer of the April 30 armed protest, Ryan Kelley, a local Republican official, last week announced a bid for governor. "Becoming too closely aligned with militias — is that a bad thing?" he said in an interview. Londa Gatt, a pro-Trump activist close to him, was named last month to a leadership position in a statewide Republican women's group. She welcomed militias and Proud Boys at protests, posting on the social media site Parler: "While BLM destroy/murder people the Proud Boys are true patriots." Prosecutors have accused members of the Proud Boys of playing a leading role in the Jan. 6 assault.

Two weeks after the Statehouse protest, Shirkey, the Republican leader, appeared at a rally by the same organizers, onstage with a militia member who would later be accused of conspiring to kidnap Gov. Gretchen Whitmer.

"Stand up and test that assertion of authority by the government," Shirkey told the militiamen. "We need you now more than ever."

After the riot in Washington, some argue such endorsements endanger the future of the party. "It is like the Republican Party has its own domestic army," said Jeff Timmer, a former executive director of the Michigan party and a vocal Trump critic.

Timothy McVeigh and Terry Nichols, who killed 168 people in the Oklahoma City bombing in 1995, were reported to have associated with militia members in Michigan, though Norman Olson, founder of the Michigan Militia, said they had been turned away because of their violent rhetoric. In the aftermath, militias were largely exiled to the fringes of conspiracy politics, preparing for imagined threats from the New World Order.

But in recent years, as the Republican Party has drifted further to the right, these groups have gradually found a home there, said JoEllen Vinyard, an emeritus professor of history at Eastern Michigan University who has studied political extremism. Much of their cooperation is centered on defending gun ownership, she said.

"I think there is a fair amount of sympathy in the Republican Party for these people that wasn't there in the past," Vinyard said. "It's a much closer relationship now."

If Michigan Republicans and militant groups had increasingly found themselves sharing the same ideological space, their common ground became literal last year, as an escalating series of events drew them together for protests and rallies. They began with objections to the governor's lockdown orders.

In the first major protest in the country against stay-at-home orders, thousands of cars, trucks and even a few cement mixers jammed the streets around the Statehouse in Lansing, in what Meshawn Maddock called Operation Gridlock. About 150 demonstrators left their vehicles to chant "lock her up" from the Capitol lawn — redirecting the 2016 battle cry about Hillary Clinton against Whitmer. A few waved Confederate flags. About a dozen heavily armed members of the Michigan Liberty Militia turned up as well.

When local armed groups in Michigan began discussing more demonstrations, most Republicans shunned them at first. "They were scared of the word 'militia,'" recalled Phil Robinson, a member of the Liberty Militia.

But his group found eager promoters in Kelley, a real estate broker and Republican planning commissioner in a suburb of Grand Rapids, and Howland, a local sales consultant who had been posting online videos minimizing the pandemic. They called the stay-at-home restrictions "unconstitutional" and formed the American Patriot Council "to restore and sustain a constitutional government," Kelley said in an interview.

Critics argued that race was an unstated factor in the battle over the stay-at-home order. The Republicans who rallied against the rules were mostly white residents of rural areas and outer suburbs. But more than 40% of the deaths in Michigan early on were among African Americans, concentrated in Detroit, who made up less than 15% of the state's population.

Those tensions spilled into the open last summer when police killings of African Americans set off protests against the country.

The Black Lives Matter protests in Michigan were rarely violent or destructive, and the largest took place in Detroit. But Republicans in the rest of the state reacted with alarm to the flashes of violence elsewhere around the country, and Trump reinforced their fears with his warnings about "antifa."

Calls to stand up to the feared rioters brought the party and its militant allies even closer together.

At the peak of the protests against police violence, Kelley's American Patriot Council aimed its sharpest attacks at Whitmer and her stay-at-home order. It released public letters urging the federal authorities to arrest her for violating the Constitution. "Whitmer needs to go to prison," Kelley declared in a video he posted on Facebook in early October that was later taken down. "She is a threat to our Republic."

A few days later, federal agents arrested more than a dozen Michigan militiamen, charging them in a plot to kidnap the governor, put her on trial and possibly execute her.

It was the culmination of months of mobilization by armed groups, accompanied by increasingly threatening language, and Trump declined to condemn the plotters. "People are entitled to say, 'Maybe it was a problem, maybe it wasn't,'" he declared at a rally in Michigan.

After the Nov. 3 election, as the counting showed Trump had lost the pivotal state, Michigan Republicans began a two-month campaign to overturn the result and keep him in power, channeling the momentum of the previous year's battles over Black Lives Matter and COVID-19.

When attempts to stop the counting failed, Meshawn Maddock in December led 16 Republican electors trying to push into the Michigan Capitol to disrupt the casting of Democratic votes in the Electoral College. During a "Stop the Steal" news conference in Washington the next day, she vowed to "keep fighting."

Marching toward the Capitol on Jan. 6, she tweeted that the throngs were "the most incredible crowd and sea of people I have ever walked with."

She pushed back on Twitter against an observer urging Sen. Mitch McConnell, the Republican leader, to take control of his party. "That's where you're very wrong," she said. "It's Trump's party now."

Maddock has condemned the violence and said she took no part. "When it comes to militias or the Proud Boys, I have no connection whatsoever to them," she wrote in an email.

Kelley and Howland were filmed outside the U.S. Capitol during the riot. Both men said they did not break any laws and argued that the event was not "an insurrection" because the participants were patriots. "I was there to support the sitting president," Kelley said.

Shirkey, the Michigan Senate leader who came around to work with the militias, declined to follow the movement behind Trump all the way to the end. Summoned to the White House in November, Shirkey refused the president's entreaties to try to annul his Michigan defeat.

But in an interview last week, the lawmaker said he nonetheless empathized with the mob that attacked Congress.

"It was people feeling oppressed, and depressed, responding to what they thought was government just stealing their lives from them," he said. "And I'm not endorsing and supporting their actions, but I understand where they come from."