A district attorney is recusing himself from the prosecution of a former candidate for governor who's charged with possessing child pornography.

Matthew Foster, the district attorney for Hancock and Washington counties, was previously represented by the same attorney as the one defending two-time independent gubernatorial candidate Eliot Cutler.

Cutler, 76, is free on bail while awaiting trial on four counts of possession of sexually explicit material of a child under 12. Each count carries a maximum penalty of five years in prison.

FORMER MAINE GUBERNATORIAL CANDIDATE AND PROMINENT DEMOCRAT DONOR ARRESTED ON CHILD PORN CHARGES

Eliot Cutler

Former Maine gubernatorial candidate Eliot Cutler, seen here campaigning in 2014. A district attorney has recused himself from a child pornography case against Cutler. (Photo by Carl D. Walsh/Portland Portland Press Herald via Getty Images)

Cutler is represented by Water McKee, who also represented Foster when he was investigated for sexual abuse of a child in 2017. No charges were filed in the case.

MAINE GOVERNOR: DEMOCRAT JANET MILLS TO REMAIN IN OFFICE, BEATING GOP CHALLENGER PAUL LEPAGE

The Bangor Daily News first reported Foster's recusal and work with McKee, which the attorney confirmed. Foster didn't return messages from The Associated Press seeking comment.

CLICK HERE TO GET THE FOX NEWS APP