Biological parents who are unmarried when they have a child both have the right to child visitation or custody unless it would be detrimental to the child. Establishing paternity is the father's first step in gaining visitation or custody, according to FindLaw.
It is often sufficient for both parents to sign an acknowledgment of paternity and file it with the court or other state agency, as required. If paternity is unclear or contested, the court requires DNA testing before issuing an order stating paternity, states FindLaw.
If the parents agree on visitation and custody, they may set up a parenting agreement that covers primary custody; visitation; who makes educational, health, and religious decisions; and a plan for amending the agreement if necessary; and ask for a court order to that effect. This court order protects the rights of both parents. If the parents cannot agree without court intervention, both parents have the right to a contested hearing, says FindLaw.