A cross-party Senate committee will launch an inquiry into why Peter Dutton used his powers as the minister for immigration and border security to allow two foreign au pairs to remain in Australia in 2015.

Government senators voted against the inquiry but the Labor motion narrowly passed in a 34 – 28 split, with the support of the Centre Alliance, the Greens and a handful of independents.

The referral came as Mr Dutton was preparing to launch a second attempt at challenging Malcolm Turnbull for the Liberal leadership.

Mr Dutton’s department spent $10,246 of public money fighting a freedom of information request for documents relating to the intervention.

Documents uncovered through the legal dispute revealed Mr Dutton had used his ministerial powers to intervene in two cases in 2015 involving women who arrived in Australia with plans to work as au pairs.

A Border Force officer “formed the view” that the first woman, who came in June 2015, was planning to work and therefore revoked her tourist visa.

But the minister’s office intervened on “public interest” grounds to prevent the woman’s deportation.

She was granted a visitor visa and allowed to stay in Australia, but still without the right to work.

An AAP journalist who broke the story in March reported that the woman made a phone call to a contact while she was in detention, and was then granted the new visa shortly afterwards.

Read more Peter Dutton: A brief history of the man who wants to be Prime Minister

The department and the minister have refused to say who the au pair allegedly called before the intervention took place.

“This is a matter for the individual, not the department,” the Home Affairs department wrote in its response to a senator’s questions.

The minister responded angrily to the initial reports in March, accusing the journalist of “seeking to suggest” that his own family had employed the au pair, or benefitted in some way.

“In my capacity as minister, I have never acted outside the Ministerial Code of Conduct,” Mr Dutton said at the time.

The matter will be referred to the Legal and Constitutional Affairs References Committee.

It is made up of members from across the political spectrum but is chaired by Labor senator Louise Pratt.

Senate inquiries have the power to question public servants who work at departments like Home Affairs.

It is not yet clear when the committee will turn its attention to the au pair inquiry.