In a legal settlement that still awaits a federal judge's approval, the IRS "expresses its sincere apology" for mistreating a conservative organization called Linchpins of Liberty — along with 40 other conservative groups — in their applications for tax-exempt status.

And in a second case, NorCal Tea Party Patriots and 427 other groups suing the IRS also reached a "substantial financial settlement" with the government.

Attorney General Jeff Sessions announced the two settlements Thursday. The Justice Department quoted him as saying of the IRS activity: "There is no excuse for this conduct. Hundreds of organizations were affected by these actions, and they deserve an apology from the IRS. We hope that today's settlement makes clear that this abuse of power will not be tolerated."

It's "a historic victory," said Jay Sekulow of the American Center for Law and Justice, a conservative nonprofit legal group representing the Linchpins plaintiffs. Sekulow, who is also on President Trump's personal legal-defense team, said the IRS agreed to stop "the abhorrent practices utilized against our clients."

The Linchpins case, in federal circuit court in Washington, D.C., has no monetary settlement. The two sides agreed to bear their own legal fees.

The consent order says the IRS admits it wrongly used "heightened scrutiny and inordinate delays" and demanded unnecessary information as it reviewed applications for tax-exempt status. The order says, "For such treatment, the IRS expresses its sincere apology."

In the separate NorCal case, plaintiffs' lead counsel Eddie Greim told NPR an IRS apology alone was not sufficient to end the matter. But he declined to reveal the financial settlement amount.

In the NorCal case, plaintiffs allege the IRS violated their constitutional rights by using tax information for improper purposes. The settlement still must be approved by the federal district court in Cincinnati, home of the IRS division on tax-exempt organizations.

The settlements may not put the fierce controversy over IRS conduct to rest, but they mark the most significant resolution so far.

The controversy began in 2013 when an IRS official admitted the agency had been aggressively scrutinizing groups with names such as "Tea Party" and "Patriots." It later emerged that liberal groups had been targeted, too, although in smaller numbers.

The IRS stepped up its scrutiny around 2010, as applications for tax-exempt status surged. Tea Party groups were organizing, and court decisions had eased the rules for tax-exempt groups to participate in politics.

Groups sought tax-exempt status as 501(c)(3) charities, where the organization and its donors get tax write-offs, and 501(c)(4) "social welfare" organizations, where donors' contributions are not tax deductible.

After the IRS confession in 2013, its top echelons were quickly cleaned out. Conservative groups sued. Congressional Republicans launched what became years of hearings, amid allegations the Obama White House had ordered the targeting.

Some GOP lawmakers repeatedly tried to oust IRS Commissioner John Koskinen, at one point seeking impeachment, and called on former President Barack Obama, and then on Trump, to fire him. Instead, Trump announced Thursday that Koskinen will leave when his five-year term expires next month.

Some conservative groups said Thursday the Linchpins settlement offers the first real apology from the agency. Catherine Engelbrecht of True The Vote, with its own IRS lawsuit, said, "For the first time, the IRS admitted their discrimination against conservative groups was wrong and unlawful."

Copyright 2017 NPR. To see more, visit http://www.npr.org/.