It depends on a lot of factors, such as parental behaviour, but if the children are young there is the "tender years principle" that very young children (under 4) are generally better off with the mother having primary custody, although the father may have liberal access. As children get older, their views will be taken into account by the judge. The overriding concern of the court is the childs welfare, not the parents. Also the court will try to be as flexible as possible - where there is shared custody, each parent will be given at least one weekend off a month (i.e. on parent will not bear the burden of minding the children every weekend).
Stability is important, but children are flexible - remember as they grow older the parents will need to be flexible too.
The most important thing is if at all possible try to agree a regime for custody and access with some flexibility in it. If it is an imposed solution it's more likely that there will be acrimony, and breaches of the terms, leading to hassle and possible court visits, which ultimately is bad for the children.
I'm not suggesting that it is happening here, but try to ensure that children are not used as pawns in the break up of the relationship. And remember, both parents remain guardians, so there will be ongoing situations which will require a level of maturity and goodwill.