AT&T Inc has settled a nationwide lawsuit by an agency accusing it of age discrimination for refusing to rehire tens of thousands of workers who had retired from the largest U.S. telephone company.

The three-year consent decree resolves an August 2009 lawsuit by the U.S. Equal Employment Opportunity Commission, which enforces federal anti-discrimination laws.

It requires AT&T to end any prohibitions against rehiring workers who left under two retirement programs between 1998 and 2001 and one related to SBC Communications Inc's 2005 purchase of the former AT&T Corp, which created the current company.

AT&T must also update its databases to ensure former workers are not blocked from being rehired and certify annually in writing it is complying with the decree.

The revised policies will not act as a barrier to hiring as employees or engaging as non-payroll workers otherwise qualified individuals, according to the decree, which was approved on Monday by U.S. District Judge J. Paul Oetken in Manhattan. The decree was made public on Tuesday.

The EEOC had accused Dallas-based AT&T of having no legitimate reason not to rehire workers who retired under the programs, a number it estimated as exceeding 50,000.

AT&T spokesman Marty Richter said on Tuesday the company is committed to complying fully with laws concerning employment discrimination.

While we had a disagreement with the EEOC over the application of the law in this case, we are pleased to have amicably resolved that dispute, he said.

The EEOC was not immediately available for comment.

AT&T did not admit the allegations in the EEOC complaint, and maintained it had had legitimate and nondiscriminatory business reasons for its earlier policy.

The EEOC brought the case on behalf of John Yates, who was 57 years old when AT&T turned him down for employment.

AT&T said it ended September with 256,210 employees.

The case is EEOC v. AT&T Inc et al, U.S. District Court, Southern District of New York, No. 09-07323.

(Reporting by Jonathan Stempel in New York; editing by Robert MacMillan and Andre Grenon)