This is a habeas corpus proceeding brought by the father, Jerry Lee Mace, to obtain the custody of Jeffery Lee Mace, age 12, Douglas Dean Mace, age 10, and Steven Jay Mace, age 9. Defendant, the mother of these children, appeals from a decree allowing the *437writ and awarding custody of the children to their father.
The record shows that the parties were divorced in Idaho December 10, 1965, and that defendant was awarded the custody of the children. On February 23, 1967, she married Laurin Dunlap. At the time of the proceedings below Dunlap had brought suit for divorce against defendant, claiming that she was having meretricious relations with another man.
The principal evidence relied upon by plaintiff Mace in this proceeding was as follows: That on two or three occasions when Mr. Dunlap was out of town defendant left the children (including Mr. Dunlap’s minor child by a previous marriage) alone from 11 p.m. until 5 or 6 a.m. the next morning to carry on her clandestine relationship with the third man; that she had previously engaged in two similar affairs while married to Dunlap; and that she began seeing Dunlap before her divorce from plaintiff. Defendant’s evidence was that on the occasions when she left the children alone she either left a phone number where she could be reached, or called to check on the children.
The defendant, despite her extra-marital misconduct, is a good housekeeper, makes clothes for the children and engages in many activities with them. She is regularly employed on a full-time basis in Portland. Her take-home pay is $424 a month. The children are neat, polite and respectful, and seem to be healthy and well-adjusted with the exception of Steven, who has had some minor health problems. The oldest boy, Jeffery, testified that he wanted to remain with his mother because all of his friends lived in town.
The plaintiff is employed by a private firm as its recreation director. He was remarried on June 1, *4381968. He and Ms present wife and her two children, aged six and nine, live in a three-bedroom mobile home on nine acres of land in Sandy, Oregon. If the plaintiff is awarded custody four boys will have to share one bedroom.
The plaintiff’s wife testified that she was not employed and would be happy to have the boys live with them. The children stay overnight with the plaintiff periodically and the plaintiff engages in other activities with the children as his visitation privileges permit.
Plaintiff, in applying for what amounts to a modification of the Idaho divorce decree with respect to the custody of the children, has the burden of showing that there has been a substantial change in the conditions and circumstances since the last order respecting the children’s custody and that such change is adverse to the children’s welfare. Bogh v. Lumbattis, 203 Or 298, 300, 280 P2d 398 (1955), He must also further demonstrate that the proposed change would be in the best interests of the children. Bogh v. Lumbattis, supra at 300.
Habeas corpus proceedings involving the custody of children are tried de novo on appeal. Quinn v. Hanks, 192 Or 254, 263, 233 P2d 767 (1951).
After reviewing the entire record, we are of the opinion that the decision of the trial judge was correct. The defendant has engaged in several extramarital affairs while married to Mr. Dunlap. Mr. Dunlap filed suit for divorce as a result of her most recent affair. "While immoral conduct standing alone may be insufficient to justify a change in custody, any moral transgressions must be considered together with other relevant factors in determining what is in the *439best interests of the children. Shrout v. Shrout, 224 Or 521, 356 P2d 935 (1960).
We have frequently emphasized the importance of stability to the well-being of children. Mackey v. Mackey, 9 Or App 113, 496 P2d 21 (1972); Hogan v. Hogan, 6 Or App 122, 486 P2d 1309 (1971); McCutchan v. McCutchan, 5 Or App 96, 483 P2d 93 (1971). The breakup of defendant’s marriage to Mr. Dunlap has uprooted the children from their home of the past three years. The defendant’s past conduct evidences an unwillingness or inability to maintain a stable domestic relationship. Her priorities are indicated by the occasions she has left her children home alone until 5 or 6 a.m. while out on dates. Under these circumstances we do not believe that the defendant can provide the stability so essential to these children.
Our decision in this case has been difficult because in some other respects the defendant has been a good mother and has provided an adequate environment for the children. However, the evidence establishes that the plaintiff and his wife can provide a good home in all respects, despite the fact that it may be somewhat crowded.
In reaching our decision we have considered all the factors set out in Tingen v. Tingen, 251 Or 458, 459, 446 P2d 185 (1968), and in addition have accorded weight to the decision of the trial judge, who had the advantage of seeing and hearing the witnesses. Bennehoff v. Bennehoff, 209 Or 224, 304 P2d 1079 (1956).
We find that there has been a substantial change of circumstances since the custody of these children was originally determined and that such change has *440been adverse to their best interests and invited a risk of causing them permanent harm. We conclude that it is in the best interests of the children to award their custody to the plaintiff.
Affirmed.