MIAMI — President Barack Obama on Thursday defended his namesake health care program, long a target of Republicans and recently criticized by some Democrats, saying millions of Americans “now know the financial security of health insurance” because of the Affordable Care Act.

“It's worked,” he said, even while allowing that the program isn't perfect. “No law is.”

Less than two weeks before the Nov. 1 start of the enrollment period for Affordable Care Act health plans, Obama flew to a south Florida college to kick off a push by the administration to encourage more people to sign up, with a particular emphasis on young adults.

Obama is trying to burnish his legacy as the president who, after decades of failed attempts by Washington, finally brought health care to millions. But what he attempted Thursday was a difficult sales job, as the 2010 law faces new and troubling challenges.

Premiums are rising by double digits in many parts of the country, and some major insurers have quit the program, leaving consumers with fewer choices next year and contributing to higher prices that are plaguing the program.

In his remarks, Obama called on both parties to set aside the “political rhetoric” and “be honest about what's working, what needs fixing and how we fix it.” He urged the new president and the next Congress to “take what we've learned over the past six years and make the ACA better.”

Obama presented his own ideas, including getting Florida and over a dozen states that haven't yet done so to accept federal funding to expand Medicaid and bring health insurance to millions more people. He also called for providing tax credits and encouraging state innovation.

Health and Human Services Secretary Sylvia Burwell said this week that she expects 13.8 million people will sign up for 2017 coverage, up from the 12.7 million consumers who picked health insurance plans during open enrollment for this year.

Under the law, more than 21 million previously uninsured people are now covered. The law also provides new protections, including allowing children to stay on their parents' plans through age 26 and providing cost-free preventive care.