If the matter has been taken to the court, how best the custody of the child will be solved? Explain in your own understanding with supports from lecture notes or any other polices.

When custody of a child is taken to court, the judges will typically make a decision based on what is in the best interest of the child. This can be a complex process, as judges will take into consideration a variety of factors such as the relationship between the child and each parent, the ability of each parent to provide for the child's physical and emotional needs, the stability of each parent's home environment, and any history of abuse or neglect.

In determining custody, courts will also consider the child's preferences, if the child is old enough to express them. In some cases, the court may appoint a guardian ad litem to represent the child's interests and make recommendations to the court.

Additionally, courts may require parents to attend mediation or counseling sessions to try to work out a custody agreement outside of court. If an agreement cannot be reached, the court will make a final decision based on the evidence presented.

Overall, the goal of the court is to ensure that the child's best interests are met and that the child has a stable and loving environment in which to thrive. The court will carefully consider all factors before making a decision on custody.