In court on Tuesday, a defense lawyer tried to get Mr. Zambada to provide more information about the ties between Mr. Lopéz Obrador and the security official. Federal prosecutors immediately objected, and Judge Brian M. Cogan shut down that line of questioning.

All of this took place as the courtroom audience was waiting for Mr. Zambada to testify about paying off a Mexican president. That expectation had been created last week after reporters saw a transcript of a sidebar Judge Cogan held with prosecutors and defense lawyers.

At the sidebar, the defense revealed a potential bombshell: that Mr. Zambada had previously told the authorities that he had paid “the now incumbent president of Mexico” at least $6 million in bribes. The defense asked for permission to bring that information out in open court.

But hours before Mr. Zambada appeared for his final day of testimony, the government filed a motion under seal “to preclude cross-examination.” The secret motion prompted another lengthy discussion out of the jury’s hearing on Tuesday afternoon, the transcript of which was also sealed.

It was only after that sidebar discussion ended that Judge Cogan shed a little light on what was going on in private. Ruling from the bench, he announced he was going to limit the questions that Mr. Guzmán’s lawyers could ask Mr. Zambada.

He said the value of the information that might be learned from a broader cross-examination did not outweigh, as he put it, “protecting individuals and entities who are not parties to this case and who would face embarrassment.”

Who those people and entities were remained unclear. But when Mr. Zambada took the stand again to finish his testimony, Mr. Guzmán’s lawyers were only allowed to ask vague questions about bribes to presidents. William Purpura, one of the Mr. Guzmán’s lawyers, asked Mr. Zambada, for example, if he would “corrupt the president of Mexico” if he could.

“Perhaps,” Mr. Zambada responded.

The government is expected to introduce 15 more cooperating witnesses who, like Mr. Zambada, will offer an inside view of Mr. Guzmán and the cartel’s operations. The defense, meanwhile, is likely to continue to argue that Ismael Zambada is the true mastermind of the organization and to press those witnesses about the extent of corruption in Mexico’s government. But Judge Cogan has made it clear he will put limits on how far that questioning can go.