D.C. Council member Jim Graham (D-Ward 1) talks with Dana Miller with her daughter Kay Sank, 15-months, at the Wilson Building on Nov. 15, 2012. (Katherine Frey/The Washington Post)

A federal judge dismissed a lawsuit Thursday against D.C. Council member Jim Graham over a disputed Metro real estate deal.

A development company, Banneker Ventures, alleged that Graham (D-Ward 1) illegally interfered in its efforts to build a residential and retail development on Metro-owned land in the Shaw neighborhood while he was on the transit agency’s board.

But District Judge Rosemary Collyer said that Graham is immune from legal action in this instance because he was acting in his official capacity as a member of the board of the Washington Metropolitan Area Transit Authority.

“It is important that WMATA officials be free to make complex decisions regarding large real-estate projects, which are often controversial, without fear of suit,” she wrote. “Mr. Graham’s challenged actions were discretionary.”

An independent investigation ordered by the Metro board concluded that Graham violated ethics rules by improperly mixing his roles as a council member and as a Metro board member when he attempted to influence the plans for the development.

According to investigators, Graham told Banneker representatives in 2008 that he would support their bid to run the D.C. Lottery if the firm dropped out of the running for the development on Florida Avenue NW.

Graham favored another developer — District-based LaKritz Adler, which also was named as a defendant in the lawsuit. LaKritz Adler was dismissed from the suit as a result of Collyer’s ruling.

In the suit filed last year, Banneker said Graham was driven by “political calculus and personal animus.” But public officials are legally protected in their official capacity, Collyer wrote, even when their actions are politically motivated.

In a 26-page opinion, Collyer noted that Graham’s “poor behavior” had been addressed through an official reprimand by the D.C. Council last February and that he is subject to reelection by voters.

In addition, Collyer rejected Banneker’s claim that Graham’s actions amounted to a breach of contract. Banneker’s agreement, she said, was not a “valid and enforceable contract” until it was approved by the board.

Banneker’s deal with Metro ended after the board voted to table its negotiations with the company in March 2010. Metro sold the Florida Avenue property in 2011 to JBG Cos. for $10.2 million.

Graham said Thursday that he was pleased with the judge’s quick decision.

“Now we can put all of this behind us and get on with the future of Ward 1 and the city,” he said. “To have it finished is a great relief.”

Dana Hedgpeth contributed to this report.

Get updates on your area delivered via e-mail.