Aetna Inc. has agreed to settle allegations that it improperly disclosed the protected health information of thousands of Americans, including HIV patients and hundreds of New Jersey residents, New Jersey Attorney General Gurbir Grewal announced Wednesday.

As part of the agreement, the insurance giant will pay the state a $365,000-plus civil penalty. It also will hire an independent consultant to evaluate and report on its privacy protection practices and monitor its compliance with the settlement.