Paxton, who will not have to enter a plea under the terms of the agreement, faced the prospect of decades in prison if he had been convicted of fraud.

Prosecutors on Tuesday agreed to drop the securities fraud charges facing Attorney General Ken Paxton if he performs 100 hours of community service and fulfills other conditions of a pretrial agreement, bringing an abrupt end to the nearly nine-year-old felony case that has loomed over the embattled Republican since his early days in office.

The deal, which landed three weeks before Paxton is set to face trial, also requires him to take 15 hours of legal ethics courses and pay restitution to those he is accused of defrauding more than a decade ago when he allegedly solicited investors in a McKinney technology company without disclosing that the firm was paying him to promote its stock. The amount of restitution totals about $271,000, prosecutor Brian Wice said.