Boston voters were expected Tuesday to narrow the mayoral field to incumbent Michelle Wu and nonprofit leader Josh Kraft, setting the stage for a fall runoff that will test whether political resistance to the Trump administration or deep personal spending will determine the city's next leader.

Wu, the city's first Asian American and first woman mayor, has maintained a double-digit lead in polls for months despite Kraft spending millions of his own money on his campaign. The race also includes military veteran and former district school committee member Robert Cappucci and community activist Domingos DaRosa, but political analysts and local observers say the contest is likely to come down to Wu and Kraft.

The campaign has unfolded against a backdrop of confrontation with the federal government. Last week, the U.S. Department of Justice filed a lawsuit against Wu, the city of Boston and its police department, alleging the city's sanctuary policies interfere with immigration enforcement. Officials in the Trump administration have accused Boston of not doing enough to crack down on illegal immigration and have threatened a surge in arrests. Wu has condemned the actions as political attacks, saying the administration is "attacking cities to hide his administration’s failures" and vowing that "Boston will never back down from being a beacon of freedom and a home for everyone."

Wu's campaign has been bolstered by broad support on the City Council, a series of high-profile policy initiatives this summer on housing, climate and crime, and endorsements from Democratic leaders. Campaign appearances often feature Wu balancing official duties with motherhood; she has frequently been photographed and described working with her infant daughter at her side.

Kraft, the son of New England Patriots owner Robert Kraft and head of Kraft Family Philanthropies and the New England Patriots Foundation, has deployed substantial personal resources to the campaign. As of the end of August, he had loaned more than $5 million to his campaign and outspent Wu $5.5 million to about $1.1 million. Despite that spending advantage, Kraft entered the final days of the primary with about $1.3 million in the bank to Wu's $2.4 million.

Kraft has at times distanced himself from the Trump administration, telling supporters last month that President Trump "has actively attacked democratic institutions and stoked hatred and division throughout our country" and that the president had "made life harder for the very people my parents, especially my mom, raised me to fight for." But he has struggled to coalesce a clear message that resonates in a city where Democrats have long dominated City Hall and where Wu has positioned herself as a symbol of opposition to the administration.

Campaign turbulence has also affected Kraft. His campaign said last week that he and two top advisers "mutually parted ways." He has pressed a message that many residents feel disconnected from city government, saying in an interview with The Associated Press that his conversations across neighborhoods revealed people "don’t feel listened to, people don’t feel connected to the mayor and the mayoral administration." He added, "Some of the polls have a big margin, but let me tell you something: Polls don’t decide elections. People decide elections."

Boston's mayoral contest is officially nonpartisan, but Democrats have held the office for roughly a century, and party politics have shaped the campaign. Political analyst Jeffrey Berry, a professor emeritus at Tufts University, said money can buy name recognition but not necessarily victory, and that Wu's standing as "a symbol of democratic resistance to the president" resonates in a city like Boston.

If Wu and Kraft advance to a general election, the runoff will likely focus on the contrast between Wu's policy record and coalition of council support and Democratic endorsements, and Kraft's bid to translate personal resources and a message of civic responsiveness into votes. The narrowing of the field on Tuesday will clarify whether the long-shot candidacies of Cappucci and DaRosa siphon enough support to change the dynamics, or whether the race will be a direct head-to-head between the incumbent and the wealthy challenger.

Voters will decide which of the two leading campaigns better addresses persistent local concerns, including housing affordability, public safety, and homelessness, while weighing how each candidate responds to ongoing federal scrutiny over immigration enforcement policies.