By Martin Hutchinson
BBC News Online health staff in Madrid
Women whose first child is a boy are more likely to suffer multiple miscarriages as they try for their next child, say doctors.
An injection could be the answer
However, a simple injection could overcome the problem - an immune reaction to proteins unique to male foetuses and their placentas.
Thousands of women in the UK have repeated, unexplained miscarriages, and many scientists believe that an overreaction by the immune system could be to blame for many of them.
A scientist from Copenhagen in Denmark studied more than 200 women who had suffered at least three miscarriages following the birth of their first child.
I believe that we already have a quite efficient treatment
Significantly more of these first children were male than female - immediately highlighting a possible link between gender and miscarriage risk.
In fact, women who had given birth to a boy were more than a third less likely to have managed another successful pregnancy than those who had given birth to a girl.
Dr Ole Christiansen, who led the study, said: "Giving birth to a son is known already to be a prognostically negative factor in many obstetrical complications.
"There are patients who will never get a second child in both groups, but the risk is larger among women whose first child was a boy.
"These women may have raised an immunological reaction against tissue types that are expressed on the surface of the placenta in pregnancies with boys.
"The placenta is created from the foetus and if is a boy it will carry these male-specific tissue types.
"The mother's immune system may be reacting by forming antibodies, but also the mother's white blood cells may be reacting against the placenta."
However, there is already a possible solution to this - studies have shown that infusing women who have had recurrent miscarriages with a drug called immunoglobulin raises the live birth rate.
However, the studies show that it does not improve her prospects if she has never had a child - suggesting that the birth of the first child is a key factor in an unwanted immune response.
Dr Christiansen said: "I believe that we already have a quite efficient treatment, as our trials have shown."