JERSEY CITY, N.J. — The mayor of New Jersey’s second-largest city on Wednesday endorsed former Obama administration ambassador Phil Murphy in next year’s governor’s race, ending his own expected gubernatorial campaign before it even officially began.

Jersey City Mayor Steve Fulop made the announcement at City Hall with Murphy by his side, saying Murphy has great instincts and the two share the same values.

“I am proud to endorse Phil Murphy for governor,” Fulop said. “I believe he will be an outstanding leader and partner in the statehouse.”

Fulop’s decision consolidates key support around Murphy’s candidacy in the voter-rich northern part of the state in what is expected to be a fierce contest in June’s primary. Senate President Steve Sweeney, a Democrat, is also considering a run and has close ties with officials in Essex County, but political experts said Fulop’s decision tilts the race in Murphy’s favor.

“Game changer,” said Patrick Murray, director of the Monmouth University Polling Institute. “Sweeney’s chances rested on dividing the north.”

Earlier this month, Murphy filed a complaint against Fulop with state election officials alleging he was financing a gubernatorial campaign using money meant for his mayoral re-election. A spokesman for Fulop called the complaint frivolous, and Murphy said Wednesday that his complaint is now moot.

Murphy said the endorsement shows that the party is uniting around his candidacy.

“I want to thank Mayor Fulop for sharing my commitment to unifying the Democratic Party,” he said.

The announcement comes amid the trial of two former allies of Republican Gov. Chris Christie who are accused of creating traffic jams on the George Washington Bridge to punish the Democratic mayor of Fort Lee for not endorsing Christie’s 2013 re-election bid. Fulop’s name has been brought up during the trial, and he is expected to testify.

He isn’t accused of any wrongdoing, and Fulop said Wednesday that there is no connection between the trial and his announcement that he will run for re-election as mayor next year. He was first elected in 2013.

David Wildstein, the government’s key witness, testified that the Christie administration ordered that Port Authority of New York and New Jersey officials not meet with Fulop because they were mad he wasn’t endorsing the governor’s 2013 re-election.

Fulop’s endorsement of Murphy, the only declared candidate in the race to succeed Christie, came as a surprise to many in New Jersey politics. The mayor’s own run for governor was all but official: His website prominently featured “2017,” he had close relationships with key figures in the Democratic Party, like Speaker Vincent Prieto, and a political action committee with ties to the mayor had begun raising millions.

Murphy declared his candidacy in May and pledged to spend $10 million of his own money on the race. Fulop is now his highest-profile backer.

Murphy, who served as President Barack Obama’s ambassador to Germany and was also a finance chairman at the Democratic National Committee, is a former Goldman Sachs executive. Fulop also worked at the firm before enrolling in the Marine Corps after the Sept. 11 attacks.

In the bridge case, Wildstein testified Tuesday that Christie’s then-campaign manager, Bill Stepien, told him to settle a rent dispute with the car company that Fulop worked for that was seeking a lease extension on Port Authority property to get his endorsement. Fulop ultimately endorsed Christie’s Democratic challenger.

Wildstein said in an email after a 2012 meeting with Fulop that he seemed “very open” to endorsing Christie, but Stepien predicted that wouldn’t happen and said Fulop was “quite a snake.”

Christie is prevented by term limit rules from running for a third time.