Hillary Clinton’s double-barreled fight for the presidency has arrived in her home state, where she is planning a weeks-long, hyper-local blitz to deal with the challenge of simultaneously competing against two fellow New Yorkers: Donald Trump and Sen. Bernie Sanders.

Although New York’s primary is still nearly three weeks away, its 247 delegates are expected to make it a critical contest in determining the Democratic nomination. Both Clinton and Sanders are campaigning heavily in New York this week, marking the beginning of a potentially long slog through the state.

But Clinton also has her sights trained squarely on Trump, issuing a new ad criticizing the Republican front-runner for his proposals to ban Muslims from entering the country and build a wall along the Mexican border — and using scenes of New Yorkers of many backgrounds to make her point.

The Big Apple as backdrop for Clinton’s two-front battle is all the more resonant given that all three candidates have deep New York ties. Trump is from Queens, and his real estate empire is headquartered in Manhattan. Sanders, along with his wife, Jane, grew up in Brooklyn. Clinton, who represented New York for eight years in the Senate, calls Chappaqua, a wealthy suburb of New York City, her primary home.

Clinton faces a somewhat tricky path in competing against both men simultaneously. While the former secretary of state’s campaign is eager to pivot to the November general election, aides are also mindful that she does not appear, particularly to Sanders supporters, as if she believes she has clinched the nomination. “It’s a difficult balance to strike,” said Bob Shrum, a veteran Democratic strategist. “She wants to pivot to the general, but she wants to do it without looking presumptuous about the primaries.”

Aides also say, however, that targeting Trump energizes the base and undermines Sanders by sending a signal to rank-and-file Democrats that she is prepared to take on Trump in the general election.

Clinton is bringing her own fighting style to the battle with these two native New Yorkers: Trump, a verbal brawler who has not spared Clinton the personal attacks that have characterized his approach to his rivals, and Sanders, a scrappy politician who is unafraid to level deep policy criticisms her way.

In her new TV ad, Clinton does not name Trump, and she brings a lighthearted touch to the critique. “When some say we can solve America’s problems by building walls, banning people based on their religion and turning against each other,” she says in the ad, “well, this is New York, and we know better.”

The Trump campaign did not immediately respond to a request for comment about the ad.

Clinton has directly criticized Sanders. In a speech in Harlem on Wednesday, she dinged him for voting with the National Rifle Association, said he is making foreign policy an “afterthought” and called him a “single-issue candidate.”

“My opponent and I share many of the same goals,” Clinton said. “But some of his ideas for how to get there won’t pass. Others just won’t work, because the numbers just don’t add up.”

Democratic presidential candidate Hillary Clinton released a short video on Twitter targeting Republican presidential front-runner Donald Trump about comments he made on abortion on MSNBC. (Twitter/Hillary Clinton)

Mostly, however, Clinton is following the same hyper-local strategy in New York that she deployed in Michigan, where she focused relentlessly on the Flint water crisis; Alabama and Missouri, where she campaigned against voter-identification laws; Arkansas, where she criticized a religious-freedom bill; and Illinois and West Virginia, where anti-union legislation has been in her crosshairs.

In New York, Clinton can go a step further and tout her leadership and accomplishments while in the Senate — a strategy that her aides hope will play well against Sanders and, in particular, political novice Trump.

On Thursday, Clinton campaigned in the Westchester County suburbs, waxing nostalgic about moving nearby in 1999, before launching her Senate career. She also rapped Trump for his controversial remarks suggesting that women who seek illegal abortions should be punished — and took aim at Sanders for saying that the controversy was a distraction from the “serious” issues in the race.

“To me, it is a serious issue and this is a very serious discussion,” she said.

Clinton planned on Friday to be in Syracuse, where she is expected to focus on manufacturing jobs she has taken credit for helping bring to Upstate communities as senator.

Sanders, too, has planned an aggressive campaign in New York to draw contrasts with Clinton, aides said — particularly on issues such as the contributions Clinton and supporting political action committees have received from Wall Street interests, the fossil fuel industry and lobbyists for the gun industry.

Jeff Weaver, Sanders’s campaign manager, said there are a lot of reasons Sanders should be appealing in the Empire State. He said his candidate will have “a pretty packed schedule” and plans to invest heavily in advertising before April 19. A television buy will start “in the very near future,” he said.

“People in New York appreciate authenticity, and they like a real fighter,” Weaver said. “We are 100 percent committed to contesting New York.”

As Sanders attempts to catch Clinton in the race for the nomination, a lot is at stake in New York’s April 19 contest, which offers the largest trove of pledged delegates aside from California between now and the Democratic convention.

The race is a homecoming of sorts for Sanders, who was born and raised in Brooklyn before he launched a political career in Vermont. The Sanders campaign recently opened its statewide headquarters in the borough, minutes from Clinton’s headquarters.

Voters can expect to hear a lot about Sanders’s humble roots in Brooklyn. During a swing through New York in February, he walked the street of his old neighborhood with CBS news anchor Scott Pelley and, seemingly on a whim, decided he would see whether he could get into the old “3 1/2 -room, rent-controlled apartment” where he grew up.

It turned out the apartment was vacant and being painted, and the painters let him in.

“God, I can’t believe how small it is,” Sanders said. “When you were a kid, it looked so big.”

Sanders staged a large rally Thursday night at a park in the Bronx, where guests included actress Rosario Dawson, director Spike Lee and Residente, a Puerto Rican performer and founder of the alternative rap group Calle 13. “If we win here in New York, we are going to make it to the White House,” Sanders said at the rally, which drew an estimated 18,500 people, including a large overflow crowd that didn’t get into the rally site.

Weaver argued that the bigger burden is on Clinton to show that she can carry New York by a comfortable margin, given that it is “her adopted home state” and she represented New Yorkers in the Senate for two terms. “We’ve got to do well in New York, obviously, but she has to do really well in New York,” Weaver said.

Weaver said Sanders’s campaign has a plan to catch Clinton in pledged delegates that does not require an outright win in New York. He did not provide details, though aides have acknowledged that he needs to win California and win it by a large margin.

Sanders faces the added challenge that he will not be able to count on independent voters — who have broken for him in previous contests — in the New York primary, which is closed to non-Democrats. However, the state has a potentially untapped progressive bent that resulted in competitive Democratic races at the gubernatorial level in 2014 — something that might benefit Sanders.

“If you look at New York state politics of the last four or five years, there’s been an increasing progressive tilt with regard to elections,” said Phil Singer, a former aide to Clinton in her 2008 presidential campaign and a longtime aide of Sen. Charles E. Schumer (D-N.Y.). “Bernie is doing very, very well with liberals and progressives. I don’t think it’s a surprise that it would be a 10-point victory for Hillary as opposed to a 30-point victory for Hillary.”

Clinton has the advantage a long track record in the state, especially on economic issues, her advisers say. “If you look at her record in the Senate, that’s an important part of her story that we haven’t talked about,” said Clinton adviser Karen Finney. “There’s a lot of talk about the ’90s and not a lot of talk about what she did when she actually had a vote.”

Clinton has deployed New York’s political heavyweights, including Schumer and Rep. Charles B. Rangel (D-N.Y.) to amplify her case to voters — and her attacks on Sanders.

As Clinton and Rangel campaigned at a Harlem bakery Wednesday, Rangel praised Sanders for calling attention to the “immoral and illegal” levels of income inequality in the United States. “Now I need some help as to what else he’s made a priority,” he said. “Bernie Sanders has always been there for social justice, and no one can challenge that. It’s just that Hillary Clinton has done something about it.”

Wagner reported from New York City.