FILE - In this Dec. 13, 2007, file photo, striking writers walk the picket line outside Paramount Studiosin Los Angeles. The clock is ticking on negotiations between television and film writers and producers before their contract expires. A strike could begin Tuesday, May 2, 2017, forcing writers to begin picketing. The previous writers' strike lasted 100 days in 2007-08 and was costly to the businesses that serve Hollywood and to consumers expecting to be entertained. (AP Photo/Nick Ut, File)

FILE - In this Dec. 13, 2007, file photo, striking writers walk the picket line outside Paramount Studiosin Los Angeles. The clock is ticking on negotiations between television and film writers and producers before their contract expires. A strike could begin Tuesday, May 2, 2017, forcing writers to begin picketing. The previous writers' strike lasted 100 days in 2007-08 and was costly to the businesses that serve Hollywood and to consumers expecting to be entertained. (AP Photo/Nick Ut, File)

LOS ANGELES (AP) — A tentative deal was reached between screenwriters and producers Tuesday, averting a strike that could have crippled TV and film production.

The three-year agreement, which requires ratification by members of the Writers Guild of America, was confirmed by the guild and producers’ spokesman Jarryd Gonzales shortly after the current contract expired early Tuesday. The deal came after a flurry of last-minute bargaining, conducted during a media blackout that offered no tangible details about whether picket lines would go up until after midnight Tuesday.

ADVERTISEMENT

In a memo to its members, the guild said gains were made across the board, including contributions to the union’s health plan that should “ensure its solvency for years to come” — an issue that writers considered key.

The union said it also made strides in pay for series with fewer episodes per season, and in residuals. Members overall will net $130 million more over the contract’s life than they were expected to accept, according to the memo.

There were no details released by the producers early Tuesday.

The agreement spares the late-night shows that would immediately have gone dark without writers, and allows the networks to pursue their schedules for the upcoming TV season without interruption. Movie production would have felt a strike’s sting more gradually.

Guild members voted overwhelmingly last month to authorize a strike, and the WGA could have called for an immediate walkout Tuesday absent a deal. The previous writers’ strike extracted an estimated $2 billion toll on the state of California. The producers group said the 2007-08 strike cost writers $287 million in lost compensation.

Russ DeVol, the chief research officer at the Milken Institute, estimated a strike of similar duration would have cost California $2.5 billion today.

After the 2007-08 strike, the two sides reached agreements in 2010 and 2013, but TV writers in particular have seen their earnings slide since then and wanted to claw back some of those losses.

Driving the dispute were changes in how television is distributed, with streaming platforms including Netflix and Amazon joining broadcast and cable TV and rising in importance.

More outlets have led to more shows, but the TV season model is greatly changed. Despite the fact that there are more series than ever — 455 this season, more than double the number six years ago — shows run for fewer episodes than the traditional 22-24 episode broadcast series.

ADVERTISEMENT

Short seasons of eight, 10 or 12 episodes means less pay for writers whose payment is structured on a per-episode basis.

To address that, the guild said it won additional compensation for writers who spend more than 2.4 weeks working on a script.

The guild also touted first-time job protection for writers on parental leave.

The agreement avoided a repeat of the 2007-08 strike, which played out in true Hollywood style. Writers took to social media to make their case, entertainingly. Stars including Julia Louis-Dreyfus and Tina Fey joined picket lines, and then-“Tonight Show” host Jay Leno brought doughnuts for strikers.

Before Tuesday’s deal was announced, writer-actress Lena Dunham said she would back a strike this time.

“I would never have had the health coverage I had without the union, and that’s one of the main points in this,” Dunham said at the Met Gala in New York City on Monday night.

Actress Debra Winger said she would support any reasonable job action by the writers, but was mindful of the damage it would cause.

“I’m thinking of all the businesses that I work with at Warner Bros. for several months out of the year and (the) restaurants, shoe repair, dry cleaners,” Winger said during an interview promoting her new film, “The Lovers.” ″The last writers’ strike affected the city of Los Angeles in a devastating way.”

At the Met Gala, CBS chairman and CEO Les Moonves said he was guardedly optimistic that a deal would be reached without a strike.

___

Associated Press writers Marcela Isaza in Los Angeles and Brooke Lefferts in New York contributed to this report.