Gov. Phil Murphy on Wednesday signed a law preserving a critical yet controversial part of the Affordable Care Act that President Donald Trump's administration repealed last year.

One of the laws creates a statewide individual mandate, which will require all New Jerseyans who don't have health coverage through a government program like Medicare or their jobs to buy a policy, or pay a fee at tax time.

The landmark federal health care law, better known as Obamacare, imposed the mandate to ensure younger and healthier people who might otherwise forgo insurance will buy-in and share costs.

But the tax package approved by the Republican-led Congress and signed into law by Trump will end the mandate in 2019. The requirement was one of the more distasteful parts of the law for lawmakers and the public who believe it allowed government to intrude into people's lives.

State Sen. Joseph Vitale, D-Middlesex, one of the prime sponsors of the law, said keeping the mandate "was needed to maintain a foundation for the insurance market and to allow the success of the ACA to continue."

Trump's actions "will usher in an era of higher health insurance costs for everyone and lower health coverage rates. We want to protect New Jersey from the negative impact," said state Sen. Troy Singleton, D-Burlington, also a sponsor.

About 800,000 people obtained insurance coverage under the law -- 500,000 through Medicaid and about 300,000 through a commercial plan.

The law (S1877) gives the state the authority to impose the individual mandate and collect a fee from people who do not buy insurance.

Experts predict ending the mandate would destabilize the health exchange -- the online marketplace at healthcare.gov -- because it would be dominated by sick or older policy holders whose costs would drive up premiums.

In 2015, 189,000 New Jerseyans collectively paid $93 million, or roughly $500 in fees, rather than comply with the individual mandate, according to IRS data collected by the research institute, New Jersey Policy Perspective.

The fees collected under the new state law would be deposited into the New Jersey Health Insurance Premium Security Fund, which is created by the second law Murphy signed, (S1878).

The fund would help pay the claims of people who are catastrophically ill, so rates would not rise dramatically. The state Department of Banking and Insurance must apply to the federal government to create the fund and a board that would control it.

Murphy, a Democrat who has often been critical of Trump, signed the bills on the same day the consumer advocacy group, the NJ for Healthcare Coalition sent him a letter asking him to act on the legislation without delay.

"We urge you to act to preserve the coverage gains we've made under the ACA and to make comprehensive health insurance affordable for more New Jerseyans by signing these bills," according to the letter.

Susan K. Livio may be reached at slivio@njadvancemedia.com. Follow her on Twitter @SusanKLivio. Find NJ.com Politics on Facebook.