A federal judge reviewing a Justice Department decision to allow U.S. pharmacy chain and benefits manager CVS Health to merge with health insurer Aetna said on Wednesday that the agreement was in fact legal under antitrust law.

Judge Richard Leon of U.S. District Court for the District of Columbia had been examining a government plan announced in October to allow the merger on condition that Aetna sell its Medicare prescription drug plan business to WellCare Health Plans. Both deals have already closed.

Leon had initially balked at approving the merger conditions and insisted on hearing from critics of the deal, but finally decided to grant the motion to approve the consent agreement. But he took aim at the common practice of companies' closing multi-billion-dollar deals while the court review, required by the Tunney Act, was still in process.

"If the Tunney Act is to mean anything," Leon wrote, "it surely must mean that no court should rubberstamp a consent decree approving the merger of 'one of the largest companies in the United States' and 'the nation's third largest health-insurance company,' ... simply because the Government requests it!"

In December, Leon said he was "less convinced" than the government that the asset sale to WellCare would resolve antitrust concerns. Since then, Centene agreed to acquire WellCare for $15.27 billion. CVS said the judge's decision reinforced that CVS and Aetna have already merged.

"CVS Health and Aetna have been one company since November 2018, and today action by the District Court makes that 100 percent clear. We remain focused on transforming the consumer health care experience in America," CVS spokesman T.J. Crawford said in an emailed statement.

The Justice Department did not immediately respond to a request for comment.

Critics of the CVS-Aetna deal included the American Medical Association and the AIDS Healthcare Foundation.

Pending Leon's approval, CVS agreed to temporarily allow Aetna to independently make critical product, pricing and personnel decisions.

CVS has been in the process of converting itself into a health-care company, and said in June that it would offer expanded health services such as nutrition counseling and blood pressure screenings in 1,500 stores by the end of 2021.

Most consent agreements that the antitrust agencies strike with companies to resolve competitive concerns are approved by federal courts with little fuss under the 1974 Tunney Act, which requires courts to ensure the agreements are in the public interest.

Companies generally do not wait for final court approval before closing their transactions.