Former attorney general Christian Porter has announced he is quitting politics and will not recontest his seat at the next election.

The Liberal MP, who was first elected to federal parliament for the Western Australian seat of Pearce in 2013, announced the decision in a lengthy Facebook post on Wednesday afternoon.

“I have spent the best part of the last 20 years in public service. This week however, I made the decision that I will not recontest the seat of Pearce at the next federal election and I have informed the prime minister of that decision,” he said.