A mother who was criticised by Spanish social workers for breastfeeding her child on demand has won back custody of her 15-month-old infant after an international campaign backed by childcare guru Sheila Kitzinger and others,.

Habiba and baby Alma, as they are being called, were reunited on Wednesday night after three weeks of forced separation when a Madrid social services committee overturned an earlier decision to temporarily remove the infant.

"It was an amazing re-encounter between mother and child," said Habiba's lawyer, Juan Ignacio de la Mata. "The child wouldn't leave her mother alone and you could see both of them slowly being transformed by the encounter. It was moving and very beautiful."

Campaigners had been calling for the baby's return to Habiba it was revealed that official reports criticised both her habit of breastfeeding on demand and of allowing Alma to sleep with her, rather than in a cot, at the publicly funded home for single mothers where she lived.

Social services sources later insisted Habiba's breastfeeding habits were not the reason the child was removed, citing more serious issues. They denied knowledge of a report criticising her breastfeeding.

"The report exists and forms part of her file," De la Mata said. "Judgments were made based on absolute ignorance."

The lawyer criticised Spain's system of allowing authorities to take a child away without giving the mother a chance to defend herself or bring in a lawyer. "In other countries you must go to a judge before you remove a child. Here it is the other way around, with authorities acting first and the mother having to appeal to get the child back."

He said the decision to remove Alma had been taken on the back of ill-informed reports by social workers who seemed more concerned about Habiba's poor relationship with the care home than her relationship with the child.

The committee backtracked only after three senior Spanish paediatricians said Habiba seemed more in tune than social workers with international recommendations on breastfeeding and sleep patterns. Campaigners found her a new home and offers of paid employment.

"She has shown that she has a job offer and has somewhere to live in an apartment for vulnerable women and children," the committee said.