Democratic presidential candidate Sen. Bernie Sanders, I-Vt., speaks during a campaign rally at Fitzgerald Fieldhouse on the University of Pittsburgh campus, Monday, April 25, 2016, in Pittsburgh. (AP Photo/Keith Srakocic)

PROVIDENCE, R.I. (WPRI) – Vermont U.S. Sen. Bernie Sanders has won Rhode Island’s Democratic primary for president, the Associated Press projects.

Sanders defeated former Secretary of State Hillary Clinton Tuesday night, despite nearly all of the state’s Democratic establishment backing Clinton.

“I am proud that we were able to win a resounding victory tonight in Rhode Island, the one state with an open primary where independents had a say in the outcome,” Sanders said in a statement. “Democrats should recognize that the ticket with the best chance of winning this November must attract support from independents as well as Democrats. I am proud of my campaign’s record in that regard.”

Clinton came out on top Tuesday in the primaries in Connecticut, Delaware, Maryland, and Pennsylvania.

There are 24 pledged Democratic delegates at stake in Rhode Island’s primary, which will be split proportionally between the two candidates. In addition, the state’s nine so-called “superdelegates” – party leaders who can choose whichever candidate they want – have all backed Clinton.

Tuesday’s primary was the culmination of a competitive contest between the two Democrats, in a year when both parties’ candidates spent significantly time and energy on Rhode Island – a relatively rare occurrence since the state began holding primaries in 1972.

Clinton won Rhode Island by 18 percentage points over Barack Obama in 2008, but in recent weeks it became clear her team was concerned about whether she could defeat Sanders this year. Bill Clinton visited the state twice to campaign, and Clinton herself spent Saturday in Central Falls and Johnston. Sanders held a massive rally in Providence on Sunday.

Rhode Island has backed the Democratic candidate in nine of the last 10 presidential elections, the exception being Ronald Reagan in 1984. The general election is Nov. 8.