When a court decides an issue about the upbringing of a child, the child's welfare shall be the court's paramount consideration. The most important factor is what is best for the child.
The law also sets out in more detail a number of things for the court to bear in mind.
This list is sometimes called the welfare checklist and it is worth looking at all seven factors as the law sets them out.