A federal judge has ruled that Mayor Vincent C. Gray and D.C. Council member Jim Graham must answer questions about the city’s controversial lottery contract.

U.S. District Judge Richard W. Roberts said Gray (D) and Graham (D-Ward 1) are required to give depositions in the case, but he strictly narrowed the scope of questioning. The ruling was issued Monday in a wrongful termination lawsuit brought by a former city contracting official.

Gray and Graham are required only to testify about communications they had with D.C. Chief Financial Officer Natwar M. Gandhi about the “demotion and termination” of the official who brought the lawsuit, Eric W. Payne.

Gandhi dismissed Payne, his contracting chief, in January 2009 after several months in which the lottery contract award had become a hot-button political issue. Payne alleges that he was fired because he resisted pressure to change the solicitation to favor bidders preferred by some council members — including Gray, who was D.C. Council chairman at the time.

In earlier court filings, Payne included the transcript of a secretly recorded meeting in July 2008 where Gandhi's chief of staff explained why he was being demoted. The aide, Angell Jacobs, told Payne that "for Gray and Graham, this is all personal," according to the transcript. She went on to say that Graham had a "personal vendetta" against one of the lottery bidders.

Roberts cited evidence presented by Payne “that Gray and Graham engaged in political efforts to exhort the executive that were not protected” under doctrines of legislative immunity, which council lawyers cited in requesting Payne’s subpoenas be quashed. Roberts also rejected arguments from the city that a deposition would “unduly burden” Gray in his duties as mayor.

But Roberts sharply constrained an earlier ruling by Magistrate Judge Deborah A. Robinson that would have allowed a more freewheeling interrogation of the elected officials.

Payne had also sought to question council member Jack Evans (D-Ward 2), but Roberts found that Payne “made no showing” that Evans ever communicated with Gandhi about Payne, only that Evans asked questions about the makeup of the lottery bidding groups.

“Asking the executive about personnel in a company slotted to win a contract the Council must approve is information-gathering within the legislative sphere,” Roberts wrote. “Cajoling the executive to fire the executive’s own personnel is not.”

Payne’s attorney, Brian K. McDaniel, said he was hoping to have more “leeway” in questioning the officials. “But we’re very pleased to have the ability to depose these individuals and learn more about their involvement” with Payne’s firing, he said.

McDaniel said he anticipated some conflict with city lawyers over whether his questions pertain to Payne’s demotion and firing, as laid out in Roberts’s order. “Hopefully we’ll be able to work though those disagreements without involving the court further,” he said.

Discovery in the case is scheduled to wrap up by the end of July.

Gray, in a statement filed with the court this year, denied any knowledge of Payne’s termination. Pedro Ribeiro, a spokesman for Gray, said the “mayor appreciates the judge’s decision” and will sit for a “limited” deposition.

“The mayor has previously stated that he did not have a conversation with Dr. Gandhi about Mr. Payne’s employment,” Ribeiro said. “He is prepared to repeat that fact under oath.”

Graham said Tuesday that he is “glad we have this clarification” and that he “certainly had no involvement in calling for Payne’s removal.”

“That’s exactly what I’m going to be saying” in a deposition, he said.