It is an “article of faith” that the UK must leave the EU to honour the referendum result, Geoffrey Cox says.
The attorney general told the BBC a customs union was “not desirable” but if that was the only way of leaving the EU, he would take it.
He suggested the government’s only option was to “seek with Labour some common ground” for a “swift exit”.
Its comes as the Brexit secretary says rejection of the PM’s deal would mean a “soft Brexit or no Brexit at all”.
Meanwhile, the PM has responded to criticism from her own party over talks with Labour leader Jeremy Corbyn by saying all MPs had a responsibility to deliver Brexit.
In an interview with the BBC’s political editor Laura Kuenssberg, Mr Cox, who has provided the government and MPs with legal advice on Brexit, said he was “completely convinced” the UK had to leave.
“We promised this country that we would do so, we promised it that we would honour the outcome of the referendum,” he said.
“The referendum said leave and leave we must.”
Mr Cox said that agreeing to a customs union would not be a “sell-out” and the UK could not be bound into this arrangement permanently.
“If we decided, in some considerable years time that we wanted to review our membership of any such customs union if we signed it – and I’m not saying we will – that’s a matter for negotiation and discussion.
“There’s nothing to stop us removing ourselves from that arrangement, so we can’t look at these things as permanent straitjackets upon this country.”
And he said his priority was to ensure the UK left.
“The remorseless logic of numbers [in the House of Commons]… means that the only way, unless the prime minister’s deal is to be voted through, is to seek with Labour some common ground, so that we can affect a swift exit.”
He said if it was a choice between not leaving and leaving with a customs union, he would “take leaving every single time”.
And Mr Cox warned that if the UK does not drop some of its “red lines”, it risks never leaving at all.