WATERLOO, Iowa (AP) — Hillary Clinton has spent much of her 2016 presidential campaign looking past Democratic rival Bernie Sanders, focusing instead on Republicans and the November general election. No longer.

Three weeks before the leadoff Iowa caucuses and with polls suggesting a tightening race, she now is confronting the Vermont senator more directly, attempting to undermine his liberal credentials on gun control, taxes, health care and even the Wall Street regulations that have been the core of his insurgent campaign.

“It’s time for us to have the kind of spirited debate that you deserve us to have,” Clinton told voters Monday. “We do have differences.”

After months with a comfortable edge in most Iowa polls, the former secretary of state finds herself battling an underdog rival in a state that has a history of rewarding anti-establishment campaigns — a situation that brings back echoes of her 2008 loss to Barack Obama.

At a forum aimed at young and minority voters on Monday night, the candidates found themselves defending their positions on immigration, criminal justice, gun control and abortion — along with tackling questions about selfies, white privilege and recently deceased rock star David Bowie.

“The inevitable candidate for the Democratic nomination may not be so inevitable today,” said Sanders, when asked about his standing in Iowa.

While she has locked up the vast majority of support from party leaders and large donors, Sanders has captured the hearts of many in the Democratic base with his unapologetically liberal economic message.

An NBC/The Wall Street Journal/Marist poll released Sunday found Clinton with 48 percent and Sanders with 45 percent of likely caucus goers, representing a closer margin than past polls have indicated.

Sanders has maintained an edge in New Hampshire, which borders his home state of Vermont, making Iowa even more important for Clinton. The NBC/Wall Street Journal/Marist poll showed Sanders with 50 percent and Clinton with 46 percent in that primary.

Clinton still holds a strong advantage among black and Latino voters who play a bigger role in the primaries in late February and March. But even if Clinton pulls out a win in Iowa, a narrow victory could set off alarms among Democrats about her strength against Sanders, who started the campaign as an obscure senator polling in the single digits.

Until now, Clinton has rarely mentioned Sanders by name at her campaign events, choosing instead to warn voters about the risks of electing a Republican. She has pointed to efforts by Republicans to repeal Obama’s signature health care law — the president vetoed the most recent try — as a sign of what could come if Democrats lose the White House.

But on Monday, she widened her health care critique to include Sanders, saying he would “rip up” the law and put power in the hands of states. Sanders said during a town hall meeting in Perry that large numbers of underinsured and sky-high deductibles demand a better health care system, which he would seek through his single-payer, Medicare-for-all system.

Said Clinton: “I sure don’t want to turn over health care to Republican governors, for heaven’s sake. I think it’s a risky deal.”

That’s not quite the situation: While states would have some leeway under Sanders’ plan, his office says they would not be allowed to opt out completely, as Republican governors have done with the Medicaid expansion provided under the current health care law.

Clinton also announced a new plan that would impose a 4 percent fee on taxpayers making more than $5 million — an effort to match Sanders’ focus on income inequality — even as she charged him with plans to raise taxes on middle-class Americans. She joined her rivals in denouncing the Obama administration’s recent deportation raids targeting Central Americans who had entered the country illegally.

And she talked about guns.

When Obama said last week he would not support a Democratic nominee who didn’t support “common-sense gun reform,” Clinton’s team quickly sought to turn it to their advantage, reminding voters that Sanders had backed legislation in 2005 that protected gun-makers from lawsuits.

“Obama and I were both in the Senate and we voted no. Sen. Sanders voted yes. That is a big difference,” Clinton said Monday.

Sanders, during a town hall meeting in Des Moines, expressed his own support for Obama’s use of executive actions to curb gun violence, suggesting little daylight between him and the president. But later that day, in the forum, he doubled down on his defense of his vote on the controversial bill, which the Clinton campaign immediately highlighted.

“It’s not a mistake. Like many pieces of legislation, it is complicated,” he said. “But on the issue of guns, let me be very clear I support the president.”

Sanders has long targeted Iowa and New Hampshire as places where he could trip up Clinton, who started the campaign with a commanding lead in national polls but has watched her advantage in the early states diminish. The senator has also pointed to favorable polls showing him outperforming Clinton in hypothetical matchups against Republicans like Donald Trump.

“This is going to be a very long nomination process,” said Sanders campaign manager Jeff Weaver.

Sanders has held multiple events in the state since Friday. Clinton was back in Iowa after a two-day trip to the state last week but has also held fundraisers in California and plans to keep a lower profile later this week, with closed fundraisers in Washington and New York.

Former President Bill Clinton returns this week, accompanied Saturday by the couple’s daughter, Chelsea. Four female senators — Tammy Baldwin of Wisconsin, Mazie Hirono of Hawaii, Amy Klobuchar of Minnesota and Claire McCaskill of Missouri — will campaign Friday and Saturday.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.