For the second time in as many negotiations, Yale and its unions settled their protracted contract dispute Thursday with the help of an outside party: New Haven Mayor John DeStefano Jr.

After nearly 19 months of unsuccessful negotiations, the mayor, who has fostered a close working relationship with Yale President Richard Levin and longstanding ties with union leaders, pulled the two sides into frequent negotiations beginning on the eve of the 23-day strike.

The mayor’s role was key in settling the tentative contracts, union and Yale leaders said at a City Hall press conference Thursday evening where they announced the settlement. DeStefano, who facilitated late-night discussions between key leaders to hammer out a settlement this week, hosted the press conference, where he explained Yale’s role in New Haven as “truly something that distinguishes our community from ordinary places.”

DeStefano said he returned home early from a trip to the Midwest Wednesday — where he was scheduled to address a conference on Thursday — because he thought there was a limited window of opportunity for an agreement.

“I think we felt that if we didn’t finish by the end of the week, it might begin to unravel,” DeStefano said.

By his own accord, DeStefano said he served as a “mediating, consoling and occasionally confronting presence” as negotiators struggled towards an agreement.

He was able to do so in large part because he has cultivated relationships with both the unions and the University. The mayor has frequently spoken about the importance of the “right to organize” — especially in the context of Yale-New Haven Hospital — and he has been consistently endorsed by the New Haven chapter of the AFL-CIO. In last week’s Democratic primaries, DeStefano supported two strongly pro-union candidates — Alderwoman Dolores Colon in Ward 6 and Drew King in Ward 22 — against incumbent aldermen who were considered much more sympathetic to Yale.

But DeStefano has also worked closely with Yale President Richard Levin and other Yale administrators on developing downtown New Haven and building a stronger partnership between the city and its largest private institution. The mayor frequently emphasizes the importance of Yale to the city, as he did in his remarks Thursday night.

Levin said DeStefano was seldom involved in specific discussions of the contract numbers, but instead tried to encourage communications between both parties.

“He was always trying to bring people together when they didn’t agree,” Levin said. “He didn’t really try to fashion compromise. He just made us keep talking.”

Local 35 president Bob Proto, who also leads the Greater New Haven Central Labor Council, said DeStefano’s involvement in the settlement would not be forgotten by union supporters, who represent a major power base in the Connecticut Democratic Party.

“I want to thank our mayor, who’s worked hard and shown for sure that he is a mayor for all the people and workers here. And our workers have been watching this very closely, and are very, very grateful for his hard work,” Proto said at Thursday night’s press conference.

John Wilhelm ’67, president of the parent union of locals 34 and 35, said DeStefano’s relationship with both sides was “without question” essential in forging connections between Yale and the unions that were frequently absent during contract negotiations.

“I think the mayor’s involvement was absolutely crucial,” Wilhelm said. “We haven’t learned to talk to each other well enough yet.”