Lawyers representing former Sen. Al D’Amato want a judge to toss his wife’s attorney off the estranged couple’s divorce case — claiming he had improper contact with the couple’s kids.

But attorney Thomas Liotta defended his actions in Nassau County Supreme Court Friday, saying the April 2 encounter only came when his client, Katuria Smith, called frantically saying she was being stalked by local cops and a private investigator at the behest of her soon-to-be ex-husband.

When Liotta arrived to pick Smith up, he piled the mom and kids into his car and drove them to another location while the PI followed them, he testified.

“I was focused on extricating my clients from a perilous situation,” Liotta told the courtroom.

Liotta said that he and Smith didn’t discuss the case while the two kids were in the car.

D’Amato’s side claims Liotta’s actions have turned him into a witness in the ongoing split, so he should no longer represent Smith.

The ex-senator also denies hiring investigators to tail his wife.

The judge has yet to rule.