Alabama's notoriously harsh anti-immigration law may have breathed its last gasp.

The state quietly settled a lawsuit over what critics called the measure's "scarlet letter" provision, which would have required the state to publish the names and other private information of immigrants unable to prove their legal status in state court.

"What you have now is the state of Alabama coming to terms with the fact that not only was this law bad policy, it was also illegal as a constitutional matter," Karen Tumlin, managing attorney for the National Immigration Law Center, told BuzzFeed News.

Alabama agreed last Thursday to drop the provision. The settlement is awaiting near-certain approval by a federal judge.

Civil rights groups — including the Southern Poverty Law Center, the NILC, and the ACLU of Alabama — challenged the law on the grounds that the information was confidential, could lead to vigilantism against immigrants, and did not accommodate changes to people's immigration status.

Alabama's law, known as HB 56, passed in 2011, and was the most extreme in a wave of state legislation across the country designed to punish undocumented immigrants in as many ways as possible. Since then the law has been steadily unraveling, with most of its major provisions either blocked by courts or dropped by the state itself. The "scarlet letter" provision is the last to fall.

Immigrant advocates say that the unraveling of HB 56 is part of a broader shift around the country away from harsh anti-immigrant laws on the state and local level. Instead, more and more states are passing what Tumlin of the NILC called "pro-immigrant, inclusive" legislation, such as laws granting driver's licenses to undocumented immigrants or in-state tuition for DREAMers.

The Alabama law and others like it were directly inspired by S.B. 1070 in Arizona, which caused a national stir in 2010 by requiring that law enforcement officers demand immigration papers from people they stopped.

But HB 56 went much further.

The law was guided by the philosophy of "self-deportation," popular among conservative Republicans — the idea that if you can make their daily life difficult enough, undocumented immigrants will leave on their own.

When the bill passed, one of its sponsors, State Rep. Micky Hammon, proudly said it "attacks every aspect of an illegal alien's life," as AL.com reported at the time. As such, Hammon said, "This bill is designed to make it difficult for them to live here so they will deport themselves."

To that end, HB 56 criminalized nearly every aspect of an undocumented immigrant's life. It made it illegal for undocumented immigrants to work or to seek work, required police to arrest anyone suspected of being in the country illegally, forced schools to check the immigration status of its students, made it illegal to rent an apartment to an undocumented immigrant, and so forth.

But the law unleashed a flurry of unintended consequences, many of them damaging to the state's economy or embarrassing to its image. It suffered a backlash from law enforcement, which did not appreciate legislators dictating their priorities, and from two of Alabama's most powerful business constituencies — agriculture and auto manufacturing — seriously undermining support for the law.

Initially, HB 56 succeeded in driving undocumented immigrants out of the state in droves. This exodus laid bare the rarely acknowledged fact that farms in Alabama, as in most states, depend on cheap labor from undocumented immigrants. Deprived of many of their workers, farmers lashed out against the law, and Republicans in the state started having second thoughts.

Then, in a widely publicized, awkward incident in November of 2011, cops in Alabama stopped a Mercedes Benz executive driving a rental car and were forced, under the new law's provisions, to arrest him when he couldn't produce acceptable ID. The executive was driving near Tuscaloosa, where Mercedes Benz has a manufacturing plant — Alabama, like many Southern states, has bent over backward in recent decades to attract foreign automakers by giving them generous tax breaks and other incentives.

Over the next two years, the law was taken apart piece by piece. Alabama settled most of the lawsuits against it, brought both by the Justice Department and by various civil rights groups, in October of 2013. By a combination of these settlements and court decisions, the state agreed to drop or significantly narrow the law's major components.

Sam Brooke, an attorney for the SPLC, highlighted one of those court decisions — Central Alabama Fair Housing Center v. Magee — which halted the law's criminalization of renting property to undocumented immigrants. That decision, Brooke told BuzzFeed News, "was fundamental in saying that there likely was racial animus behind the passage of this law."

By and large, Alabama's immigration law has died a quiet death. None of the settlements and decisions burying HB 56's various components have met any real opposition, even from the lawmakers who originally championed the bill.

The law's opponents say this is because HB 56 proved to be little more than a headache and an embarrassment to Alabama. And even as the House of Representatives is pursuing similarly harsh anti-immigrant bills on the federal level (such as the SAFE act), they also tie the decline of HB 56 to a broader turn away from anti-immigrant legislation around the country on the state and local level.

Tumin, of the NILC, said that similar laws in Georgia, Indiana, Utah, and other states have been scaled back or blocked in recent months, usually in the face of lawsuits like the ones that brought down HB 56.

The outlier, Tumin said, is Arizona, which continues to aggressively defend legal challenges against S.B. 1070, the progenitor of all other anti-immigrant laws around the country.

"It's telling that you're not seeing new proposals that target immigrants coming out of statehouses," Tumin said. "The era of anti-immigrant state policies has subsided."