Raycom Media and Cox Communications reached an agreement late Friday that returned WAFB-TV to the cable company’s lineup shortly before 9:30 p.m., WAFB general manager and vice president Sandy Breland said in an email.

The contract dispute affected about 165,000 Cox subscribers in the WAFB market, according to the station. The new agreement covers WAFB/CBS-Channel 7; WAFB HD/CBS-Channel 1007; WBXH/MyNetwork-Channel 16; and WAFB/Bounce TV-Channel 121 in the Baton Rouge area.

In addition to the Baton Rouge area, Raycom pulled programming in the Franklin/Patterson areas and in the Lake Charles area: KPLC/NBC-Channel 7, KPLC HD/NBC-Channel 1007 and KPLC/Bounce TV-Channel 130.

Raycom stations in Louisiana, Florida, Ohio, Virginia and Arizona also went dark as a result of the dispute, which began Jan. 1 when the old contract between the companies expired.

Details of the agreement, which came only hours after Cox and Raycom issued statements sharply criticizing each other, were not immediately available late Friday.

In a statement emailed by Cox spokeswoman Sharon Bethea earlier on Friday, the cable company accused Raycom of misleading customers by saying Cox refused to air Raycom’s channels.

Cox said instead Raycom sent Cox a threatening certified letter on Dec. 27, warning Cox that airing those channels without Raycom’s permission would violate federal law. In the letter, Raycom said Cox could face “significant fines” for copyright infringement, and Raycom will enforce its legal rights “to the fullest extent.”

Meanwhile, WAFB posted a video on its website of an unidentified woman giving Raycom’s point of view of the dispute.

In the video, the woman says Cox is refusing to reach a fair deal to keep WAFB on the air even though Cox customers are still paying for the service.

“That’s not fair,” she says. The Raycom spokeswoman advises Cox customers to demand a rebate or switch to another provider.

Raycom has said it asked Cox for an increase that amounts to around 2 cents a day per household.

In its statement, Cox said that amount represents an increase of more than 200 percent.

Multiplying 2 cents per day by 30 days per month by the number of Cox subscribers works out to millions of dollars more each year than the cable company is already paying Raycom, Cox said in its statement. If Cox agreed to the same percentage increase for all the programming it carries, the average customer’s cable bill would increase more than $75 a month.

The dispute centered around retransmission fees, which cable companies pay to broadcast companies in order to air their programs.

The fees have become an important source of profit for broadcasters, who have seen ad revenue dwindle, and a growing source of contention.

In 2012, broadcasters cut off programming 91 times, a jump of 78 percent over 2011, according to the American Television Alliance, which represents cable companies and other distributors.

Craig Freeman, an associate professor at LSU, said retransmission fees were originally designed to support local television programmers and broadcasters. But the fees have become a kind of necessity for networks and the operators of smaller stations, he said. The Federal Communications Commission is looking at ways to defuse the issue.

“It’s tough to say a cable operator has to negotiate with every single station in order to set the fees,” Freeman said.

“It may be un-American to approve a kind of scale,” he said, “ but I could easily see a situation where you say, this station has this rating or has these numbers so they (the cable company) should pay this amount.”

However, Freeman said it’s impossible to say when or if that idea would be adopted.

“Everyone wants their slice of the pie, and nobody wants to give up anything in this, including what you see now with Cox and Raycom,” Freeman said.

One solution for consumers who tire of spiraling cable rates: get an antenna, Freeman said. A lot of the newer television sets can decode high-definition signals.

Freeman, a Garden District resident, said he paid $16 for an antenna and can watch HD programs for free.