MPs have voted against an attempt to force the government to allow 3,000 unaccompanied child refugees into the UK from Europe.
The Labour amendment to the Immigration Bill was rejected by 294 to 276.
Ministers argued that offering sanctuary to lone children who have already reached Europe could mean more fall into the hands of traffickers.
This was dismissed by Lib Dem leader Tim Farron as "bogus" while some Tory MPs also backed the amendment.
Following the vote, Labour peers said they would propose an alternative amendment in the Lords on Tuesday. If they are successful, the matter could return to the Commons.
The government announced last week it would take in as many as 3,000 refugees, mostly vulnerable children, from the war-torn Syria region by 2020.
But campaigners, including charity Save the Children, are calling for 3,000 unaccompanied children who have already made it into Europe to be allowed into the UK.
The amendment to the Immigration Bill, tabled by Labour's Lord Dubs, was backed by Labour, the Lib Dems and the SNP.
Lending his support, Conservative backbencher Stephen Phillips said "exceptional times call for exceptional measures", urging colleagues to back the amendment.
Responding to Immigration Minister James Brokenshire's argument, he said: "These children are already in Europe. They are alone, far from their families, they are cold, frightened, hungry, frequently without help or access to those who might help or protect them."
Labour's refugee taskforce chairwoman, Yvette Cooper, suggested the government was leaving the problem to other countries like Greece which could not take the strain, while shadow immigration minister Keir Starmer said the argument that admitting the children would create a "pull factor" for more refugees was "flimsy".
Children, who were sleeping rough with no possessions and nowhere to go, were slipping into sexual exploitation and trafficking, and then disappearing, Mr Starmer told BBC Radio 4's Today programme.
"We cannot turn our backs on these vulnerable children in Europe. History will judge us on this one," he said.
But Conservative Sir Edward Leigh said the government's position was "fair" because it was better to help children in danger in Syria rather than those who have made it to Europe.
'Head and heart'
Mr Brokenshire told MPs the government "wholeheartedly shares" the desire of the Lords to protect unaccompanied children.
But he said the challenge was in balancing "head and heart" and expressed concern that the Lords amendment could put more children at risk with families choosing to send them abroad alone, into the hands of traffickers.
The minister said: "Our starting principle is that we must put the best interests of children first and avoid any policy that places children at additional risk or encourages them to place their lives in the hands of people traffickers and criminal gangs.
"In any response we need to be careful not to inadvertently create a situation in which families see an advantage in sending children ahead, alone and in the hands of traffickers, putting their lives at risk by attempting treacherous sea crossings to Europe."
Europe should, "in essence", be a "safe space", he said.