Ben Affleck testified before a congressional panel on diplomacy and national security on Thursday, and the actor and director used the opportunity to give a shoutout to his "colleague" Patrick Leahy, the senior senator from Vermont.

"To Senator Leahy, I would be remiss if I did not acknowledge my co-star in 'Batman,'" Affleck said in reference to the 74-year-old lawmaker's cameo appearances in 1997's "Batman and Robin," 2008's "The Dark Knight" and 2012's "The Dark Knight Rises."

"(Your) role is marginally smaller than mine, but I understand you're quite good," Affleck told Leahy.

The Vermont senator – an avowed "Batman" aficionado – will apparently appear once again in next year's "Batman v. Superman: Dawn of Justice," Comic Book Resources noted. Leahy, however, has been "tight-lipped about his potential involvement," the website added.

Despite the humor, Affleck's testimony before the Senate Appropriations Subcommittee for State, Foreign Operations and Related Programs had a serious background: The founder of the Eastern Congo Initiative, which is trying to rebuild the country's coffee industry, tried to emphasize the importance of U.S. foreign aid in the African nation, the Guardian said.

The "Good Will Hunting" star noted that coffeehouse chain Starbucks had just purchased 40 tons of coffee from eastern Congo for consumption in the United States.

"That's a clear testament to what's possible for Congo," Affleck said about the purchase. "This isn't charity or aid in the traditional sense. It's good business."

Also present at the congressional hearing was Microsoft founder Bill Gates, who argued that U.S. aid had "a major impact" in improving agricultural productivity in the world's poorest countries, according to the Guardian.

"Given that 70 percent of all people living in extreme poverty are in rural areas, and most are engaged in farming, the renewed U.S. commitment to agricultural development represents a very sensible, cost-effective approach to reducing global poverty," Gates insisted.

Affleck, meanwhile, jokingly lamented that he had to testify alongside the computer pioneer.

"Thanks for having me follow the greatest and most important philanthropist in the history of the world," he said. "I'm sure I'm going to come off great."