Mayor Marty Walsh and casino mogul Steve Wynn have reach a deal that could fetch $368 million for the city over the span of 15-years, Walsh announced on Wednesday. 

Walsh had fought against the Wynn Casino from the beginning, but Wynn has agreed to pump money into youth organizations and Charlestown to fix the traffic patterns at Sullivan Square, the major access point between Boston and Everett.

Wynn and the City of Everett will break ground on the $1.7 billion project this summer, with hopes of opening the casino doors in 2018. 

Boston had filed several lawsuits against Wynn, challenging the legality of the license in December. 

“Our efforts over the past two years have been to protect the people of Boston and ensure the neighborhood of Charlestown is treated fairly,” Walsh said in a statement. “Residents have been trying for years for a solution for traffic congestion in Sullivan Square and Rutherford Avenue, and we must work together to improve local transportation infrastructure. I offered to keep an open line of communication throughout this process and I thank Steve Wynn for coming back to the table to listen to Boston’s needs.”

Wynn and Walsh negotiated the terms of the Surrounding Community Agreement, which includes $31 million over 15 years for community impact, $25 million over 10 years for Sullivan Square infrastructure improvements, $11 million for traffic mitigation in Charlestown, $250,000 for a Regional Working Group on a long-term fix for Sullivan Square, $1 million for reimbursement of professional expenses, and a good faith effort to purchase $20 million annually over 15 years from Boston businesses according to city data.