The Inaugural Ball for President Barack Obama hosted by BET Networks at the Smithsonian American Art Museum and National Portrait Gallery. (Rick Diamond/Getty Images for BET)

BET Networks, the country’s largest cable network for African American audiences, is moving its headquarters from Washington to New York, ending a nearly 40-year relationship with its home town.

The move — part of a years-long transition into the Manhattan offices of its parent company, Viacom — comes as major cable networks struggle to stay relevant. ESPN earlier this year announced widespread layoffs to make up for millions of lost subscribers, and many others have been facing similar battles as customers cancel their cable in favor of streaming video services such as Hulu and Netflix.

BET’s Washington office, which has about 40 full-time employees and 36 freelancers, will close July 7.

“This closure is in line with our overall strategy to make New York BET’s new headquarters,” Debra L. Lee, the network’s chief executive, wrote in a memo to staffers on Tuesday.

BET, once a prized, black-owned cable network, has in recent years struggled to hold its own against smaller outfits such as TV One and Bounce TV. The network’s gospel show, “Joyful Noise,” which is taped in Washington, was among its lowest performers, with a reported viewership of 13,000. (There have, however, been a few bright spots: The recent premiere of the miniseries “The New Edition Story,” for example, attracted 4.2 million viewers, marking a five-year high for the network.)

Viacom, which acquired BET for $3 billion in 2000, has said it plans to build BET into one of its flagship channels, alongside MTV, Comedy Central and Nickelodeon.

“I know that this period of uncertainty has caused some anxiety, and I really appreciate your patience,” Lee wrote to staffers. “Like many of you, I too grew up on this campus, and I am honored that D.C. is the birthplace of BET.”

Robert L. Johnson, a former cable-industry lobbyist, along with his wife at the time, Sheila, founded Black Entertainment Television in 1980, with $500,000 in funding and a $15,000 bank loan. In its earliest form, the channel offered a few hours of programming — mostly music videos and reruns of black sitcoms — each week. But quickly, BET grew to become a stand-alone channel complete with its own scripted programming. A decade after its founding, it was turning an annual profit of more than $9 million and attracting 4 million new subscribers each year.

Robert Johnson, who went on to create RLJ Lodging Trust, could not be reached for comment. Sheila Johnson, now CEO of Salamander Hotels & Resorts and a partner in the WNBA’s Washington Mystics, was not available for comment, according to her spokesman.

BET’s move to New York is likely to cut costs and help executives secure more advertising, said Neil Foote of Foote Communications, a Dallas-based media firm.

“The critical challenge for any African American media outlet is getting advertising money,” said Foote, who is also president of the National Black Public Relations Society. “Being in New York, BET would literally be a cab ride or a walk away from the largest marketers and ad agencies.”

But, he and others said, the company’s move out of Washington — where African Americans made up 70 percent of the population in 1980, when the company was founded — deals a symbolic blow to the region.

“BET setting up in Washington certainly sent a message to the world that it was okay to be here,” Foote said. “It also gave the network a certain credibility.”

“When I first walked into BET, I saw a sea of black people doing the same jobs that I had always seen only whites doing elsewhere,” Curtis Gadson, a former executive vice president at the company, told Forbes in 2001. “I was almost in tears. The playing field was all of a sudden equal.”

In the decades since, Washington’s African American population has steadily declined. As of 2014, black residents were no longer a majority.

At the same time, BET’s programming shifted, too, from music videos that were largely produced in its Washington studios to a lineup of scripted series and reality shows produced in Los Angeles, New York and Atlanta.

“BET having its headquarters in D.C., that was a landmark for so many of us,” said Karen Taylor Bass, president of TaylorMade Media, a public relations firm in New York. “That was the first thing we’d see when we were coming in on the Amtrak. And as an African American executive, I remember feeling such a sense of pride seeing that building in the skyline.”

That building in Northeast Washington, along with two studios — on nearly eight acres of land — is up for sale.

Also on the market: the chief executive’s house. Lee, who plans to split her time between Los Angeles and New York, put her 11,000-square-foot Northwest Washington house up for sale late last year for $13.5 million. The price has since been lowered to $11.5 million.

BET will continue to keep its offices in Chicago and Los Angeles. Bass said the company’s move from Washington is bittersweet.

“There’s a secret sauce when you have a headquarters that reflects the people of the community,” she said. “This feels a bit like when Motown moved from Detroit to Los Angeles. It was just never the same after that.”