(AP) — Anheuser-Busch InBev reached a final agreement with the Department of Justice, settling a dispute over its $20.1 billion acquisition of the Mexican brewer, Grupo Modelo.

The world's largest brewer has been trying since June to buy the half of Grupo Modelo that it doesn't already own. The Justice Department blocked the deal out of concern that a company that massive would stifle competition in the U.S.

In an effort to appease regulators, AB InBev subsequently struck a side deal that gives control of the production of Corona and other Modelo beers sold in the U.S. to a competitor, Constellation Brands Inc.

The companies involved in the complicated series of deals have negotiated for months with Justice officials to resolve the dispute.

The agreement announced Friday is similar to a modified deal that was aired earlier this year, requiring the sale of Modelo's entire U.S. business, including licenses of Modelo brand beers and its Piedras Negras brewery, as well as its stake in a joint venture agreement and other assets to Constellation Brands Inc.

The Department of Justice said the settlement will ensure competition in the beer industry nationwide to the benefit of U.S. consumers.

The two sides must still get court approval before the deal goes through.

The acquisition could be completed as early as June, if it receives court approval.