After two days of marathon negotiations — and mounting frustration throughout the league — the NFL and the officials’ union announced at midnight Thursday that a tentative eight-year agreement had been reached to end a lockout that began in June.

The deal came on the heels of Seattle’s chaotic last-second win over Green Bay on Monday night in which the replacement officials struggled. Commissioner Roger Goodell, who was at the bargaining table Tuesday and Wednesday, said the regular officials would work the Browns-Ravens game at Baltimore on Thursday night.

“We are glad to be getting back on the field for this week’s games,” NFL Referees Association president Scott Green said.

What took them so long?