BANGOR, Maine — If you don’t have one already, you may want to apply for a passport because soon a Maine driver’s license might no longer be an accepted form of identification to access federal facilities or board aircraft for domestic flights.

That’s because Maine isn’t in compliance with a law regulating state-issued IDs, passed in 2005 in response to the 9/11 terrorist attacks, and the federal government this week rejected the state’s request for additional time to comply.

In a letter dated Oct. 11 sent to the Maine secretary of state’s office, the Department of Homeland Security said the state would not get additional time to comply with provisions of the Real ID Act because it had “not provided adequate justification for continued noncompliance.”

But getting into compliance won’t be easy because the Legislature in 2007 passed a law that prohibited the state from complying with Real ID amid concerns it would create a de facto “ internal passport.” The secretary of state’s office said Wednesday that it can’t take steps to comply with Real ID until the law is repealed and that compliance will take time.

“It would take several months to implement the changes at [the Bureau of Motor Vehicles] to come into compliance, not accounting for the time it would take for the Legislature to act on changing the law,” Kristen Muszynski, spokeswoman for the secretary of state’s office, said in an email.

She pegged the price tag of compliance at $1 million.

Maine is among 27 states and five territories not in compliance with the law, and it has a grace period until Jan. 29, 2017, before federal agencies stop accepting Maine-issued identification. Four other states — Kentucky, Oklahoma, Pennsylvania and South Carolina — also have grace periods until the same date, while requests for additional time to comply are under review for Montana, Guam and the Virgin Islands.

Once that date passes, federal facilities — including military bases, nuclear power plants and the U.S. mint, among others — will not permit access to visitors with Maine-issued identification as long as the state is not compliant with the federal law, according to the letter from Homeland Security.

The consequences from not complying with Real ID increase as Homeland Security continues to roll out the final phase of implementation. In January 2018, travelers who want to board domestic flights will need identification compliant with Real ID or an accepted alternative, such as a U.S. passport or passport card.

Patrick Sclafani, regional public affairs officer of the U.S. General Services Administration, said Wednesday in an email that it was too early to tell whether Maine residents would be denied access to federal buildings. Identification is not required to enter the Margaret Chase Smith Federal Building in Bangor, but it is required on the third floor where the federal court is located. Identification also is required to enter the Edward T. Gignoux U.S. Courthouse in Portland.

Maine-issued identification still will be accepted for voter registration, being licensed to drive and applying for or receiving federal benefits.

In January, Secretary of State Matthew Dunlap told the BDN that the state has met several requirements of the federal law. It has tightened security where licenses are made and licenses are valid for only eight years. Undocumented immigrants can no longer get Maine licenses.

But Maine has failed to meet some of the act’s more controversial requirements, such as using facial recognition software at Bureau of Motor Vehicles offices and fingerprinting Bureau of Motor Vehicles employees. In addition, the state hasn’t started to use Homeland Security-approved security markings on ID cards.

Real ID originated as a policy recommendation included in the 9/11 Commission Report. The report recommended additional security policies to prevent undocumented immigrants and terrorists from obtaining U.S. driver’s licenses. Several of the 9/11 hijackers had obtained state-issued driver’s licenses in the months leading up to the attack.

The hijackers, however, entered the U.S. with State Department issued visas and passports, and the federal government has largely exempted itself from the law, Dunlap told the BDN last year. Foreign passports are among the other accepted forms of identification for boarding an aircraft.

Homeland Security said in its Oct. 11 letter that Maine could get additional time to comply with Real ID if it demonstrates it is taking steps to get in line with unmet provisions of the law. So far, however, the Legislature has shown little interest in complying with the federal government, and legislative action is unlikely until the next Legislature is seated in 2017.

“The Legislature was hoping that the extension would be granted, so it was put on the back burner,” Democratic Rep. Andrew McLean, the House chair of the Legislature’s Transportation Committee, which oversees the Bureau of Motor Vehicles, said on Wednesday. “We’re going to have to have a conversation about complying with the federal government. What the outcome will be, I’m not sure.”

BDN writer Judy Harrison contributed to this report.