WASHINGTON — If federal prosecutors pursue corruption charges against Sen. Robert Menendez, they will face a difficult task in making their case.

Members of Congress accused of trading their official actions for personal gifts or campaign donations, as prosecutors are suggesting Menendez, D-N.J., may have done, can rely on several legal defenses to stave off a conviction, experts say.

A federal official said Friday that charges are expected to be filed against Menendez, whose relationship with donor Salomon Melgen has been under scrutiny for more than two years. In denying wrongdoing, Menendez explained his longstanding relationship with Melgen, an ophthalmologist who owns eye clinics in South Florida.

“Everyone knows he and his family, and me and my family, have been real friends for more than two decades,” Menendez said. “We celebrate holidays together, have been there for family weddings and funerals, and have given each other birthday, holiday, and wedding presents – just as friends do.”

To convict Menendez under relevant federal corruption laws, prosecutors would have to prove Menendez acted knowingly in return for personal gifts – such as flights on Melgen’s private jet and visits to his resort home in the Dominican Republic.

Prosecutors appear to be trained on two instances when Menendez intervened on Melgen’s behalf, according to a Feb. 27 court decision from a federal appeals court in New Jersey.

Menendez is said to have advocated for Melgen in 2012 discussions with high-level executive-branch officials regarding a Medicare billing dispute. He is also said to have pressed U.S. Customs and Border Protection to favor a Melgen-owned company under contract to provide screening equipment for Dominican ports.