The LNP candidate who nearly toppled former treasurer Wayne Swan at the 2013 federal election says he abandoned the party because of its internal struggle with same-sex marriage and racial discrimination laws.

Rod McGarvie ran against Mr Swan for the LNP in both 2010 and 2013 and, at the last election, reduced the former treasurer's two-party preferred margin to just 1.9 per cent.

Rod McGarvie (right) and Wayne Swan at a Brisbane Times debate prior to the 2013 federal election. Credit:Renee Melides

But on Wednesday, he was preselected by the Family First party to top its Queensland Senate ticket at the next federal election, which was due in 2016.

Mr McGarvie said a "defining moment" in his decision to leave the LNP was the Abbott government's decision not to repeal section 18C of the Racial Discrimination Act.