Updated

A New York resident got into a high-profile fight with the state government this week after officials ordered him to turn over his gun license and his firearms -- a dispute that exposed potential problems with the recently passed gun law.

Buffalo-area resident David Lewis has since gotten his license reinstated in what was apparently a case of mistaken identity under the state's new SAFE Act. The case drew outrage on gun-rights blogs warning that the state was exploiting the law to seize weapons.

Lewis' lawyer, indicating this may be an indication of a broader issue, also claims to be representing a second client in a similar circumstance.

Lewis initially received a notice on April 1 from the Erie County clerk saying that his license was being immediately suspended. He was ordered to surrender it along with his seven registered handguns.

"Based on the information received from the New York State Police, your pistol license [redacted] has been suspended by direction of the Licensing Officer for Erie County," reads the letter sent to Lewis and obtained by Fox News. "Failure to comply with this court directive upon receipt of this letter will be sufficient grounds for the revocation of your pistol license."

More On This...

Lewis, who does not have a criminal record, caught the eye of state officials because it was believed that because of a prescription for psychotropic drugs that he was a danger to others, his attorney claims.

A provision in the recently passed NY SAFE Act calls for individuals with serious mental illness who may be dangerous to potentially have access to firearms restricted.

Lewis, after receiving the notice, contacted his lawyer Jim Tresmond, who accompanied him to the police department in Amherst and filed for a local hearing to have his client's privileges restored.

Tresmond said in media reports that Lewis did have a temporary, short-term issue and required medication, but nothing recent. He suggested in a radio interview that his client's private medical history was accessed by the government, violating his rights by using a loophole under HIPAA laws.

Erie County Clerk, Chris Jacobs, whose office issued the letter to Lewis, said in a statement released late Wednesday that the mishap was due to flaws in the SAFE Act.

"When the State Police called to tell us they made a mistake and had the wrong person ... it became clear that the State did not do their job here, and now we all look foolish," he said in the statement. "Until the mental health provisions are fixed, these mistakes will continue to happen."

In a motion filed by Erie County Supreme Court Judge M. William Boller on Thursday, Lewis' privileges were restored immediately after it was determined that he was sent the letter in error.

"This court has determined that the information received from the New York State Police, which served as the basis for suspension of the Licensee's firearms license, was in error" reads the court order from Judge Boller. "...it is HEREBY ordered, the suspension of the firearms license herein is hereby terminated, and any firearms of the licensee being held by any police agency are to be returned."

The lawyer intends to file suit against the state.