SOUTHLAKE, Tex. — He was called a terrorist and a stealth jihadist out to impose a system of Islamic law on the naive and unsuspecting citizens of suburban Texas.

Some days, Shahid Shafi thought about quitting, rather than enduring a campaign by ­ultra-right-wing conservatives to oust him from his Republican Party leadership post because he is a Muslim.

But Shafi prevailed, retaining his position as vice chairman of the Tarrant County GOP and becoming a symbol of religious freedom. He’s a sought-after speaker now and a rising star in the party, with Republican Gov. Greg Abbott and Sen. Ted Cruz among his high-profile supporters.

“To grow our party, we need to add conservative Americans of all types, not subtract them,” Shafi, 54, said at a recent fundraiser in Houston, where the well-heeled crowd of political elites gave his message of inclusion a standing ovation.

While GOP leaders’ calls for unity have sought to bury what many viewed as an embarrassing moment for the party, not everyone is ready to move on. The fight over Shafi has exposed an enduring rift among Republicans and a battle for the heart of the party, one that some fear could help flip Texas from red to blue.

The fight over Shafi’s appointment comes as the historic election of two Muslim women — both Democrats — to Congress has become a political firestorm stoked by President Trump. Recent comments from one, Rep. Ilhan Omar (D-Minn.), about Israel and 9/11 have stirred controversy and prompted retaliatory tweets from the president, including a video this weekend that combined footage of Omar and the twin towers — highly charged images that many view as Islamophobic and fear could put Omar’s life in danger.

In Tarrant County, home to 2 million people just west of Dallas, Republicans have remained divided since the January vote on Shafi’s future. Peacemaking attempts have faltered, donations have declined, and each side plans to oust the other in precinct elections next year.

The fissure has only deepened the ideological fault line between traditional “big tent” Republicans and the “America First” camp, at least in this part of North Texas. Tarrant County historically has been one of the most reliably red urban counties in Texas, but its voters went for charismatic challenger Beto O’Rourke, a Democrat, over Cruz in last year’s U.S. Senate race.

“It’s a civil war,” said James Scott Trimm, a conservative blogger who said he opposed Shafi because of his stance on Israel, not his religion.

“We’re going into an election year, and with a bunch of party leaders fighting, we risk losing House races, the Senate race and the presidency, for heaven’s sake,” Trimm said. “At the end of the day, we need to be worried about winning Republican elections, not fighting among ourselves.”

'It's stealth jihad'

Shafi, a trauma surgeon and Pakistani immigrant, was a relatively unknown City Council member in the tony Fort Worth suburb of Southlake — where the median income is $189,432 — when he was appointed vice chairman of the Tarrant County Republican Party in July.

The move outraged several of the party’s more conservative precinct chairs, who launched a contentious effort to remove him from his post. In addition to demonizing his religion, they suspected him of supporting gun control and argued that he did not go far enough in declaring support for Israel.

In January, the precinct chairs met for a final vote on Shafi, gathering in a Pentecostal church, where the windows were papered over to block TV news cameras and protesters, including one woman who wore a burqa in a show of opposition to Shafi’s appointment.

They ultimately decided to allow Shafi to keep his leadership position by a vote of 139 to 49. A beaming Shafi told reporters that the vote reaffirmed his belief “in my party and my country.”

As part of the party leadership’s peacemaking effort, Trimm — one of Shafi’s most vocal opponents — was appointed to the recruitment committee, a move that ignited more furor among those who wanted to move on from the headline-grabbing incident. The committee chairman quit, and the group was disbanded.

Major donors avoided the county party’s Lincoln Day dinner, which netted $38,000, far less than the $150,000 or so it made in other years, according to party officials.

Now, some of the Tarrant49ers, as Shafi’s opponents call themselves after the 49 votes against him, are seeking retribution. They have set their sights on defeating Shafi’s supporters, taking control of the party and shifting it to the right.

Over iced tea at a suburban mall cafe, one of the group’s leaders, Dorrie O’Brien, said the Tarrant49ers oppose Shafi not only because he is Muslim, but also for a whole host of reasons, including that he has not strongly voiced his support of Israel or the Second Amendment.

O’Brien, a precinct chairwoman and an editor of romance and science-fiction novels, believes Shafi is part of a global conspiracy to impose Islam’s moral code of sharia law on the United States and that he is a member of the Muslim Brotherhood — the transnational Islamist group long accused of extremist ties.

Her primary piece of evidence, she says, is that Shafi once attended an interfaith Ramadan dinner in Dallas with others she presumes are members of the Brotherhood.

“It’s stealth jihad. It’s soft jihad,” she said. “He’s never going to pull out a sword and cut my head off. He’s not going to hurt anybody physically. He’s an influencer. The damage he does is by normalizing this ideology, making it look good and safe, and it’s not.”

Shafi smiles when asked about these allegations, which he has denied.

“Listen, I’m an immigrant to this country, and I’ve faced far worse adversity,” he said. “There was a time when I didn’t have enough to eat. At the same time, I’ve found a lot of opportunities as well.”

Shafi arrived in the United States in 1990 as a newly minted doctor. After he was rejected by the first 100 surgery programs to which he applied, he pursued a master’s degree in public health at Johns Hopkins University. During those lean years, he found that he could stave off hunger with one small order of salty McDonald’s french fries if he drank enough water.

He underwent surgical training at the Rutgers New Jersey Medical School and the University of Pennsylvania before he and his wife, Ayesha, a radio executive, moved to Texas to start a family. They joined a tide of other immigrants who have made the Dallas-Fort Worth area the fourth-largest enclave of Muslims in the country.

Shafi says he was inspired to join the Republican Party shortly after he became a U.S. citizen in 2009, drawn to its message of small government after a childhood spent in Karachi under military rule.

When he decided to run for City Council in 2011, friends and family warned him that voters in Texas would never accept a Muslim in post-9/11 America.

“I never believed it,” he said. “I’ve always been welcomed with open arms and warm hearts in the Republican Party.”

When he finally won the seat in 2014, bigotry trailed him, even in that first flush of victory. Shortly after the election, a school board member in a nearby community wrote on her Facebook page: “YOU NOW HAVE A ‘MUSLIM’ on the City Council!!! What A SHAME!!!!!”

The woman later apologized.

The political heart of Texas

Analysts say the Texas Republican Party is at a critical juncture heading into the 2020 presidential election, with the possibility that an increasingly diverse population will make Texas a swing state. So far, the risk is remote, but the number of people of color in Texas is rising. According to the Texas Demographic Center, people of color accounted for 58 percent of the state’s population, up from 47 percent in 2000.

November’s dismal election results for Republicans were a wake-up call, party officials say. Cruz barely pulled off a victory over O’Rourke, and the party lost two state Senate seats and 12 state House seats to the Democrats.

“I’m warning people: If we don’t do the hard work that we must, we will not, nor would we deserve to, retain control of Texas,” said James Dickey, chairman of the state Republican Party. “We have to continue to earn the votes of rural Texas and increase the numbers in the major metro areas that are growing the fastest.”

As Texas Republicans attempt to widen their reach, they’re grappling with the party’s standard-bearer, Trump, whose anti-immigrant, anti-Muslim rhetoric has emboldened some of the more extreme members of the party.

“There is a tension here because President Trump has been very outspoken,” said Matthew Wilson, an associate professor at Southern Methodist University in Dallas and an expert in religion and politics. “I think the statewide and broader Republican leadership wanted to powerfully send the message of religious tolerance, that Islam is not a disqualifier for patriotism. It’s a bad look for the party to appear hostile to that.”

Shafi declined to say whether he voted for Trump — “that’s between him and me” — or whether he supports the Trump administration’s travel ban targeting Muslim-majority countries or the $5 billion sought for a wall on the Mexican border. He would say only that he believes in “securing the border by any means necessary.”

Among the supporters that the Tarrant49ers have targeted for defeat is Lisa Grimaldi Abdul­kareem, a 42-year-old paralegal and a party precinct chairwoman. Abdulkareem is Christian but married to an Iraqi who served as a translator for U.S. troops during the Iraq War.

When Abdulkareem, 42, spoke up in support of Shafi, she became the victim of an online hate campaign, with her home address leaked. Despite years working for conservative candidates, Abdul­kareem was targeted by the anti-Islam website Understanding­, which described her as “another jihadi-defending Muslim working inside the Republic [sic] party. Someone wake up the GOP in Texas!!!”

One commenter suggested Texans should “geehaad her ass.”

Abdulkareem feels that the episode could become a point of change for mainstream Republicans in her state.

“For a long time, they didn’t think this small group of people would really affect the party. They have ignored them for years,” Abdulkareem said of the local GOP leadership. “Now they’ve realized they’ve got to stop doing that, because it’s scaring people away.”

Julie Tate contributed to this report.