The attorney general for the District of Columbia reached a $40 million settlement with Michael Saylor and the software company he founded, MicroStrategy, in what the attorney general’s office said was the largest income tax fraud recovery in Washington history, The New York Times has learned.

The settlement, which is expected to be announced on Monday, stems from lawsuits filed in 2021 and 2022 accusing Mr. Saylor of evading more than $25 million in income taxes in Washington. Mr. Saylor enlisted MicroStrategy’s help to file fraudulent forms from 2005 through 2020 claiming that he lived in either Virginia or Florida, states with significantly lower income tax rates, and he did not pay any income taxes to the district during that period, the attorney general’s office said.

MicroStrategy and Mr. Saylor deny any wrongdoing. They agreed to the $40 million settlement, which included interest and penalties, to avoid the expense and time of further legal action, according to the settlement, which The Times has reviewed. Mr. Saylor, who is the executive chairman of MicroStrategy, stepped down as chief executive in 2022.

“Michael Saylor and his company, MicroStrategy, defrauded the district and all of its residents for years,” Brian L. Schwalb, the attorney general, said in a statement. “Indeed, Saylor openly bragged about his tax-evasion scheme, encouraging his friends to follow his example and contending that anyone who paid taxes to the district was stupid.”

“As I stated at the time this case began, in 2012 I moved to Florida and made Miami Beach my home. Florida remains my home today, and I continue to dispute the allegation that I was ever a resident of the District of Columbia,” Mr. Saylor said in a statement. “I have agreed to settle this matter to avoid the continued burdens of the litigation on friends, family and myself.”

The lawsuit said that in 2012, “Mr. Saylor embarked on a scheme to fraudulently misrepresent himself to be a resident of Florida,” which has no personal income tax, and bought a house in Miami Beach, obtained a Florida driver’s license and registered to vote in the state.