WASHINGTON (AP) _ The Bush administration accepted a compromise from New Hampshire on Thursday that will ensure the state's residents will not be barred from using their driver's licenses to enter federal buildings and board airplanes beginning in May.

That leaves only Maine and South Carolina as states that have not struck such an agreement to receive an extension from the Homeland Security Department to implement the post-9/11 law called Real ID.

The department is considering a request from Maine that the federal government not penalize state residents for not complying with the law.

Earlier this week, South Carolina's attorney general ruled it was too early to sue the federal government over the law and encouraged state officials to tell Homeland Security what the state has already done to enhance driver's license security.

Real ID-compliant driver's licenses would have several layers of new security features to prevent forgery. They would also be issued after a number of ID checks, including verification of birth certificates, Social Security numbers and immigration status. Officials acknowledge it will take years to phase in all the different security measures.

A week ago, the department granted Montana an extension even though state officials did not ask for one and are declining to follow the law. The state's Democratic governor, Brian Schweitzer, said that administration officials had "painted themselves in a corner."

The Bush administration says the law, passed after the Sept. 11 attacks, will hinder terrorists, con artists and illegal immigrants. Opponents say it will cost too much and weaken privacy protections.

Unless holdout states send a letter by the end of March seeking an extension, their residents no longer can use driver's licenses as valid identification to board airplanes or enter federal buildings beginning in May, Homeland Security Secretary Michael Chertoff has warned. They would have to present a passport or be subjected to secondary screening.

New Hampshire had asked to be exempted, but Homeland Security Department officials did not find the state's original letter to be legally acceptable. A letter from the state dated March 26, however, satisfied the department as a valid request for an extension.

Sen. John Sununu, a New Hampshire Republican concerned about the privacy issues involved, said he would continue to seek the repeal of the Real ID law.

"New Hampshire and numerous other states have proven that they take this issue seriously and are capable of addressing this significant national security concern without intrusive and unfunded federal mandates," Sununu said in a statement.

Chertoff has offered to phase in the law's requirements over about 10 years.

But with President Bush leaving office in January, a decision to move ahead with Chertoff's plan will rest with the next administration.

By 2014, according to the plan, anyone seeking to board an airplane or enter a federal building would have to present a Real ID-compliant card, except people older than 50, officials said. That exception would give states more time to get everyone new licenses, and officials say the threat from someone in that age group is much less. By 2017, even people over 50 must have a Real ID-compliant card to board a plane.

Copyright 2008 The Associated Press.