In a unprecedented move, the Commons passed a motion accusing ministers of contempt for ignoring a previous vote of Parliament that said the legal advice provided by Geoffrey Cox, the attorney general, should be published in full.
The vote was passed by 311 votes to 293 after the DUP, whose votes Ms May relies on to maintain her governing majority, backed the motion.
The text condemned the decision not to release the "full and final" legal advice and "orders its immediate publication". It did not say what would happen if ministers continue to refuse to comply, but a second motion is likely to be tabled that would sanction Mr Cox or another senior minister. This could lead to them being suspended or even expelled from the Commons.
It vote came after ministers refused to back down and insisted it was against the national interest for the full legal opinion provided by to the Cabinet to be made public.
Downing Street said Ms May had told the Cabinet that "there is a long-standing convention that neither the fact nor the content of law officers' advice is shared outside Government without their consent".
The prime minister's spokesman said "it is an essential part of the functioning of government that Cabinet ministers can have access to candid legal advice" without the threat of it being published.
Last month, the Commons backed a Labour motion demanding that all legal advice provided to ministers on the proposed Brexit deal be made public.
Instead, ministers published a 43-page summary of the advice and took the unusual step of sending Mr Cox to the Commons to give a statement and answer MPs' questions.
The government had tabled an amendment to the motion of contempt that would have referred the matter to the Commons Committee of Privileges - a move that would likely delay the row beyond next week's "meaningful vote" on the prime minister's Brexit deal. MPs voted down that amendment by 311 votes to 307.
Speaker John Bercow had granted an urgent debate on a motion alleging contempt of Parliament after a request from all of the other Commons parties. Mr Bercow said he had deemed there was an "arguable case" that a contempt had been committed.
Opening the debate, Labour's shadow Brexit secretary, Sir Keir Starmer, said it was "not good enough" for ministers to claim it was not in the national interest to release the documents.
He told the Commons: "The government is willfully refusing to comply with a binding order of this House, and that is contempt.
"Yesterday the attorney general as good as admitted it, when he said 'I wish that I could comply with the request of the House, but if i did I sincerely believe it would not be in all our interests'. Slightly later he said 'Although the House says I should disclose, I believe the public interest compels me not to do so. I'm sorry.'"
"That is a plea of mitigation, it is not a defence."
Responding for the government, Andrea Leadsom, leader of the Commons, said: "No honourable member could say in all honesty that the attorney general has done anything other than treat this House with the greatest of respect, there can be no question that he or the government has acted in a manner which is contemptuous of this House.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies