Democratic presidential candidate Hillary Clinton held a campaign rally in Philadelphia, Penn., as primary elections take place in Connecticut, Delaware, Maryland, Pennsylvania and Rhode Island. (Reuters)

Hillary Clinton all but secured the Democratic nomination Tuesday after a long and bruising primary fight against rival Sen. Bernie Sanders, scoring decisive victories in four of five East Coast states to cast ballots.

In the last big day of multiple contests before Democrats conclude their primary voting in June, Clinton won Pennsylvania, Maryland, Connecticut and Delaware, and Sanders won in tiny Rhode Island, the only state where independents could vote in the Democratic contest.

Overall, Sanders picked up a fraction of the delegates awarded to Clinton.

While not mathematically eliminated, the liberal senator from Vermont, whose outsider campaign captured a current of Democratic discontent, remains far behind and now faces nearly impossible odds as the nominating contest draws to a close.

Clinton all but declared victory over Sanders on Tuesday, turning her sights to the Democratic National Convention, to be held here in July, and a possible general election race against Republican Donald Trump.

Before a boisterous crowd of 1,300 in Philadelphia, Clinton asked Democrats to imagine a more hopeful, compassionate country “where love trumps hate.”

Speaking to Sanders supporters, Clinton said she intends to unify the party. She appealed to their shared values, including reducing income inequality, college affordability and universal health coverage.

“Our campaign is about restoring people’s confidence in our ability to solve problems together,” Clinton said. “That’s why we’re setting bold, progressive goals backed up by real plans.

“After all, that is how progress is made,” she said. “We have to be both dreamers and doers.”

Tuesday’s performance allows Clinton to reposition her campaign for the general election fight against Republicans in ways that have been difficult to do while fending off Sanders’s persistent, well-funded and remarkably successful challenge.

Her speech Tuesday included an appeal to moderate independent voters, who Democrats believe may be looking for a home in a general election if the Republican nominee is Trump.

“If you are a Democrat, an independent or a thoughtful Republican, you know their approach is not going to build an America where we increase opportunity or decrease inequality,” Clinton said. “So instead of us letting them take us backwards we want America to be in the future business.”

Both Democratic front-runner Hillary Clinton and rival Bernie Sanders vowed to tackle problems important to Americans in Appalachia on April 26, after voters in Maryland, Pennsylvania, Connecticut, Delaware and Rhode Island went to the polls. (Sarah Parnass/The Washington Post)

Trump, declaring victory Tuesday, repeated his new epithet for Clinton: “Crooked Hillary.”

“She will not be a good president,” he said. “She doesn’t have the strength. She doesn’t have the stamina.”

He added: “If Hillary Clinton were a man, I don’t think she’d get 5 percent of the vote.”

Sanders has pledged to remain in the race, but in a statement Tuesday night, he suggested motives besides winning the nomination, such as shaping the Democratic party’s platform, that would keep him in the campaign.

“The people in every state in this country should have the right to determine who they want as president and what the agenda of the Democratic Party should be,” Sanders said. “That’s why we are in this race until the last vote is cast.”

He listed several issues he would like to see in the Democratic platform, including a $15 minimum wage and the kind of single-payer health-care system that Clinton has not embraced.

Sanders had rallied early in Huntington, W.Va., in a state that holds its primary in two weeks.

“This campaign is not just about electing a president. It is about transforming our nation,” Sanders told a crowd of 6,400.

Clinton’s big victory in New York last week appeared to give her a boost in Pennsylvania, the largest state in play Tuesday, with 189 delegates. Sanders aides once thought he could win there because it shares demographic and economic characteristics with majority-white Midwestern states he had captured earlier.

Clinton has routinely outpaced Sanders among registered Democrats, while Sanders — who has run as an independent in his congressional races — cleans up with unaffiliated voters.

Tad Devine, Sanders’s senior strategist, said the candidate and his top aides plan to talk Wednesday about how his path to the nomination has been affected by Tuesday’s results, but he said he sees no scenario in which Sanders drops out.

“Is our path to the nomination affected by five states voting? Yes,” Devine said. “Is something dramatic going to happen? No, I don’t think so.”

In a fundraising email sent about two hours before the polls closed, Sanders told supporters that “the political establishment wants us to go away so they can begin their march to the center.”

“Our path to the nomination was never narrower than the day I announced my candidacy. I will not stop fighting for an America where no one who works 40 hours a week lives in poverty, where health care is a right for all Americans, where kids of all backgrounds can go to college without crushing debt, where there is no bank too big to fail, no banker too powerful to jail, and we’ve reclaimed our democracy from the billionaire class.”

Sanders is poised to perform well in Indiana and has said he expects to outright win other states voting soon, including West Virginia, Kentucky and Oregon. But there are no big prizes on the Democratic calendar in May that would allow him to capture a large number of delegates.

Clinton’s lead among pledged delegates was above 200 before Tuesday’s voting and could be roughly 300 after Tuesday after lopsided victories in delegate-rich Pennsylvania and Maryland.

There are 14 Democratic contests left, including those in Puerto Rico and the District of Columbia, and Clinton has roughly 80 percent of the delegates she needs to win when factoring in superdelegates who have publicly declared support for her.

To catch Clinton, Sanders would need to win approximately 80 percent of the vote in most or all of those contests, margins neither candidate has previously won. Even if Sanders were to score a blowout in California, which offers more than 500 delegates on June 7, Clinton appears certain to have locked up the nomination.

Clinton is ahead 46 percent to 42 percent in the latest Fox News poll from Indiana, with 92 delegates at stake. The next four contests offer a combined 171 delegates — not enough for Sanders to make much of a dent.

A huge number of delegates are up for grabs on June 7 — 781 — but by then, Clinton is likely to need only a fraction of those to reach 2,383 to clinch the nomination. Heading into Tuesday’s contests, Clinton had 1,428 pledged delegates to Sanders’s 1,153, according to an Associated Press tally. She had 518 superdelegates, the party elders and elected officials who can cast a ballot for any candidate at the nominating convention, to 39 for Sanders.

Rhode Island had only 24 delegates at stake Tuesday. Because Democratic delegates are awarded proportionately, a victory there means Sanders is likely to pick up only a couple of delegates. Connecticut had 55 delegates in play; only 21 delegates were at stake in Delaware.

Sanders is still outraising and outspending Clinton — and drawing crowds vastly larger than those she typically attracts.

In another sign that Sanders plans to continue the fight against Clinton, his campaign sent out a fundraising solicitation Tuesday that included a photo of Hillary and Bill Clinton attending Donald Trump’s wedding.

“Over the past few days, Hillary Clinton’s campaign and some of its top supporters have launched an odd new line of attack against people like you who stand with Bernie. They are saying that by continuing to campaign and fight for every vote, for every delegate, that we are helping Donald Trump,” said the email solicitation, which was signed by Jeff Weaver, Sanders’s campaign manager. “Let me be clear, there is one candidate in this Democratic primary who Donald Trump said would make a ‘great president,’ and it’s not Bernie Sanders.”

In recent days, Sanders has said it will largely be up to Clinton to earn the support of his voters if she is the party’s nominee.

Scott Clement contributed to this report.