The Trump administration, after years of litigation, has settled lawsuits with Tea Party and other conservative groups who say they were unfairly targeted by the IRS under the Obama administration.

Attorney General Jeff Sessions announced early Thursday that the Justice Department had entered into settlements with Tea Party groups whose tax-exempt status was significantly delayed by the IRS dating back to 2013, “based solely on their viewpoint or ideology.”

The settlements involve payments to the plaintiffs and an apology from the IRS.

The targeting scandal drew heavy attention in 2013 when the IRS admitted it applied extra scrutiny to conservative groups applying for nonprofit status. Lois Lerner, then head of the Exempt Organizations unit responsible, became the public face of the scandal, though other IRS officials were involved as well.

Sessions said that groups with names involving “Tea Party” or “Patriots,” or those with specific policy positions concerning government spending, were subject to “inappropriate criteria” to “screen” applications.

JUDGE ORDERS IRS TO REVEAL WHO TOOK PART IN TEA PARTY TARGETING

“The IRS’s use of these criteria as a basis for heightened scrutiny was wrong and should never have occurred,” Sessions said in a statement Thursday. “It is improper for the IRS to single out groups for different treatment based on their names or ideological positions.”

While the IRS did not immediately respond to Fox News’ request for comment, court documents show that the agency did offer an apology.

“The IRS admits that its treatment of Plaintiffs during the tax-exempt determination process, including screening their applications based on their names or policy positions, subjecting those applications to heightened scrutiny and inordinate delays, and demanding some Plaintiffs’ information that TIGTA determined was unnecessary to the agency’s determination of their tax-exempt status, was wrong,” the IRS said in court documents. “For such treatment, the IRS expresses its sincere apology.”

The Justice Department’s settlement would pay the claims of each of the over 400 groups in the case. The attorneys for the groups said it was “a great day for the First Amendment,” but noted that day “was too long in coming.”

“The Government’s generous settlement with the Class Plaintiffs fully vindicates their claims that the IRS targeted Tea Party and conservative groups based on their viewpoint,” lead counsel for the conservative groups, Eddie Greim, told Fox News in an email. “However, like Lois Lerner’s stated apology back in 2013, any recent so-called 'apology' by the IRS has little value. That is because the Service continues to suggest that its targeting was really just ‘mismanagement.’”

Greim added: “This story was dismantled in our case. For taxpayers to be truly confident that the IRS has changed, it needs to be truthful about its past abuse of power.”