Section 30. A minor child of divorced parents who is a native of or has resided five years within this commonwealth and over whose custody and maintenance a probate court has jurisdiction shall not, if of suitable age to signify his consent, be removed out of this commonwealth without such consent, or, if under that age, without the consent of both parents, unless the court upon cause shown otherwise orders. The court, upon application of any person in behalf of such child, may require security and issue writs and processes to effect the purposes of this and the two preceding sections.