MINNEAPOLIS -- Keith Ellison is a Democrat running for an open House seat in a heavily Democratic district. But what once looked like a cakewalk has turned into a bruising campaign in which many facts are disputed but a central one is not: If he wins, he will be the first Muslim elected to Congress.

Before he can make history, Ellison must capture Tuesday's hotly contested Democratic primary in Minnesota's 5th Congressional District, which consists of the Minneapolis side of the Twin Cities and an inner ring of suburbs. Whoever gets the Democratic nomination is expected to sweep to victory in November to succeed Rep. Martin O. Sabo (D), who is retiring after 28 years in the House.

Ellison, 43, is a two-term state legislator. He prays toward Mecca five times a day and says he has not eaten pork or had a drink of alcohol since he converted to Islam as a 19-year-old student at Wayne State University in Detroit. When speaking at mosques or to members of Minneapolis's large Somali immigrant population, he opens with "Salaam aleikum," Arabic for "Peace be with you."

Other than that, he seldom refers to his religion on the campaign trail, unless asked.

"I'm a Muslim. I'm proud to be a Muslim. But I'm not running as a Muslim candidate," Ellison said during a break between a commemoration of Hurricane Katrina and an appearance at a public housing project. "I'm running as a candidate who believes in peace and bringing the troops out of Iraq now. I'm running as a candidate who believes in universal, single-payer health care coverage and an increase in the minimum wage."

Despite Ellison's desire to focus on the war and the economy, questions about his faith and character have kept him on the defensive.

The most damaging accusations, says Christopher Gilbert, professor of political science at Gustavus Adolphus College in St. Peter, Minn., concern Ellison's past associations with the Nation of Islam and its leader, Louis Farrakhan.

Although four Democrats are seeking the nomination, Ellison became the candidate to beat in May, when the state's Democratic-Farmer-Labor organization endorsed him.Within days, Michael Brodkorb, author of a Republican blog called MinnesotaDemocratsExposed.com, dug up two articles that Ellison had written under the name of Keith Hakim for the University of Minnesota student newspaper when he was in law school there in 1989 and 1990.

The first article defended Farrakhan against accusations of anti-Semitism. The second called affirmative action a "sneaky" form of compensation for slavery, suggesting instead that white Americans pay reparations to blacks.

Another conservative blog, PowerLineBlog.com, subsequently revealed that the candidate had used the names Keith X Ellison and Keith Ellison-Muhammed during his student days. In more than 20 Web postings titled "Who Is Keith Ellison?" PowerLine asserted that he had been a "local leader" of the Nation of Islam and accused him of "involvement" in anti-Semitism.

Badly stung, Ellison responded quickly. He met privately with key Jewish supporters, spoke publicly at a synagogue in the suburb of St. Louis Park and repudiated Farrakhan in a May 28 letter to the Jewish Community Relations Council in Minneapolis.

While denying that he had ever joined -- much less led -- the Nation of Islam, he acknowledged that he had worked with the group for about 18 months to organize the Minnesota contingent to Farrakhan's 1995 Million Man March in Washington.

In the letter to the council, he apologized for failing to "adequately scrutinize the positions" of Farrakhan and other Nation of Islam leaders. "They were and are anti-Semitic, and I should have come to that conclusion earlier than I did."

In interviews on the campaign trail last week, Ellison said his attraction to Islam in the 1980s "had a political angle to it, a reaction against status quo politics."

But he said he has stayed a Muslim, and grown in his faith, while his political outlook has moderated since he began practicing law, serving in the state legislature and raising four children with his wife, Kim, a high school math teacher who has multiple sclerosis.

When he was one of three blacks among 265 members of the University of Minnesota Law School's class of 1990, he said, "my perspective was a tunnel vision; I was mostly concerned about the welfare of the African American community."

"That was the era of [Spike Lee's film] 'Do the Right Thing,' " he continued. "Remember that? People had their black, yellow and red kufi caps on. There was higher African American consciousness. . . ."

Even in those days, Ellison added, "I never said anything that was anti-Semitic, racist, homophobic in any way." But, he said, he was slow to judge those who did.

"I chalked it up to typical mainstream press attacking African American leadership," he said. "When you're African American, there's literally no leader who is not beat up by the press. . . .

"The change of heart I had is, I did start to look more closely, and I feel that African Americans, having been victims of slavery and Jim Crow, can never justify doing the same thing to anyone else; wrong is wrong everywhere," he said.

Based on such assurances, Jewish Democratic activists have rallied around Ellison. Samuel and Sylvia Kaplan, a Minneapolis couple who are influential fundraisers, said he reminds them of the late senator Paul Wellstone (D-Minn.). Phyllis Kahn, a fellow Democrat in the state legislature, said it is "inconceivable that he could have ever been an anti-Semite."

Mordecai Specktor, editor and publisher of the American Jewish World, Minnesota's Jewish weekly, strongly endorsed Ellison in a Sept. 1 editorial. "His association with the Million Man March -- there are some people in the Jewish community who cannot forgive him for that," Specktor said. "I decided that he had a sincere change of heart and mind."

Among Muslims, Ellison's campaign has generated excitement.

"There are millions of Muslims in this country. It shouldn't have taken this long to elect one to Congress," said Nimco Ahmed, 24, a Somali immigrant and political organizer.

Nihad Awad, executive director of the Washington-based Council on American-Islamic Relations, flew to Minneapolis for an Aug. 25 fundraiser for Ellison, who has collected about $400,000, mostly from individual contributors in his district. Awad said that the attacks of Sept. 11, 2001, have both heightened prejudice against Muslims and spurred Muslims to be more politically active in hopes of countering that prejudice.

According to CAIR and other Muslim groups, Ellison would be the first Muslim elected to national office. Awad said the highest Muslim elected official now is a state senator in North Carolina, Larry Shaw, and the last Muslim to make a serious bid for Congress was Ferial Masry, a Saudi-born woman who lost in California in 2004.

Ellison's Democratic opponents are Ember Reichgott Junge, a former state senator who is backed by Emily's List and other women's groups; Mike Erlandson, who was Sabo's longtime chief of staff and has the retiring congressman's support; and Paul Ostrow, a Minneapolis City Council member.

For the most part, they have refrained from mentioning Ellison's religion or attacking him directly, though Ostrow's campaign manager resigned two weeks ago after admitting that he was the source of anonymous e-mails to reporters accusing Ellison of campaign finance violations

In mid-summer, Ellison was hit by allegations involving unpaid traffic and parking tickets, late payment of some taxes in the 1990s, failure to meet deadlines for financial reports in past election campaigns, and his defense of a gang leader while he was running the Legal Rights Center, a nonprofit law office.

Ellison acknowledged last week that his driver's license had been suspended earlier in the year for failure to pay fines. He said he defended a leader of the Vice Lords gang, Sharif Willis, because Willis was working with local police to broker a gang peace. And he said he was now up-to-date on tickets, taxes and financial filings.

"When will the story stop being Farrakhan or traffic tickets?" he said as he headed toward his next campaign appearance. Then he stopped, as if a thought had just come to him.

"I know this is just a taste of what it will be like if I win," he said.