If someone is harassing you it is possible, in some circumstances, to get what is known as a peace bond. That is a court order requiring that person to leave you alone and (usually) stay a specified distance away from you. The peace bond also requires more generally that the person bound by it keeps the peace and doesn't break the law.
You can get a peace bond if you are afraid that another person will harm you, your partner (spouse or your common-law), your child, or damage your property. The other person could be anyone - a neighbour, an acquaintance or a family member. The peace bond is an order from the court, or an agreement that a person makes with the court, "to keep the peace and be of good behaviour".
Peace bonds are not given out without good reason.
Basically you have to have a genuine fear of physical harm.
The process involves you going before a Justice of the Peace and telling them, under oath, what has been happening. If the Justice concludes you have a genuine fear the Justice will set a date for a hearing.
The person who has been harassing you will get a chance to speak to a Justice of the Peace and explain why a peace bond is not appropriate. Often they will claim YOU have been harassing them and a peace bond should be granted against you!
If the Justice of the Peace concludes a peace bond is appropriate one will issue.
Having a peace bond ordered against you does not mean you have a criminal record -- but breaching a peace bond is a criminal offence and can lead to criminal charges.