Two dozen entertainment firms said Friday they have agreed to pay $70 million to settle age discrimination claims by 165 television writers over the age of 40 in the largest settlement of its kind.

The defendants include 17 television networks and production companies, including ABC, CBS, Fox and NBC, and seven talent agencies including the now-merged William Morris Endeavor Entertainment, Gersh and UTA.

The settlement caps nearly a decade of court battles. Just one outstanding case, against Creative Artists Agency, remains.

The writers said the defendants refused to hire or represent them because of their age. When they were represented, the writers alleged their agents didn't present them aggressively to studios for job openings.

The money covers attorneys' fees and damages, and writers must apply to access the funds. It was not immediately clear how much each plaintiff was entitled to receive.

About $2.5 million will go to a fund that will give writers grants and loans to further their careers, and to study ways to supplement pensions and improve medical coverage.

Two-thirds of the settlement money is being covered by insurance carriers...