OTTAWA -- The Liberals have defeated an opposition motion calling for a public inquiry into allegations that the Prime Minister's Office pressured former attorney general Jody Wilson-Raybould to help SNC-Lavalin avoid criminal prosecution.

Wilson-Raybould herself abstained, telling the House of Commons she didn't think it appropriate to vote on a matter in which she was personally involved.

But two Liberals -- Toronto MP Nathaniel Erskine-Smith and New Brunswick MP Wayne Long -- joined all the opposition parties in supporting the motion.

The vote came just a couple of hours after Wilson-Raybould attended her first Liberal caucus meeting since resigning from cabinet last week.

Prime Minister Justin Trudeau says he took the opportunity to apologize to his former minister for being too slow to denounce anonymous comments and editorial cartoons about Wilson-Raybould that some considered racist and sexist.

He says the allegations need to be fully aired but he argues that inquiries by the federal ethics commissioner and the House of Commons justice committee are sufficient to get to the bottom of them.