Bill Cosby gave an exclusive interview to The National Enquirer in 2005 in exchange for a promise by the tabloid that it would drop a more damaging article about previously undisclosed sexual assault allegations, according to his testimony in a federal lawsuit.

Mr. Cosby was at the time facing allegations by Andrea Constand, a staff member with the basketball program at Temple University, Mr. Cosby’s alma mater, who said she had been drugged and molested by him a year earlier.

In previously sealed court documents at Federal District Court in Philadelphia, Mr. Cosby acknowledged under oath in September 2005 that he sought to block The Enquirer from publishing its interview with Beth Ferrier, a former model who said he had drugged and sexually assaulted her in the mid-1980s, because he thought a second account would bolster the credibility of Ms. Constand’s accusations. The documents had been unsealed in recent months, and in response to requests from the news media were released on Wednesday.

“I would give them an exclusive story, my words,” Mr. Cosby said when asked in the deposition in the sexual assault case about his agreement with The Enquirer, according to the court documents. In return, The Enquirer “would not print the story of — print Beth’s story,” Mr. Cosby said.