
210 Va. 442 (1970)
BARBARA T. POOLE
v.
ROBERT E. POOLE, III.
Record No. 7040.
Supreme Court of Virginia.
January 19, 1970.
A. Lee McGratty (Tiffany & Poland,    on brief), for appellant.
J. T. Camblos (Belt, Camblos & Pickford,    on brief), for appellee.
Present, All the Justices.
Father petitioned corporation court for custody of child which had been awarded to mother by Texas court incident to divorce decree there, and as ancillary relief petitioned that mother be enjoined from removing the child from the jurisdiction.  Error for corporation court to entertain jurisdiction since Juvenile and Domestic Relations Court has exclusive original jurisdiction of question of custody.
Appeal from a decree of the Corporation Court of the City of
I'ANSON
I'ANSON, J. delivered the opinion of the court.
Plaintiff, Robert E. Poole, III, filed a petition in the Corporation Court of the City of Charlottesville against the defendant, Barbara T. Poole, asking that custody of the infant daughter of the parties be taken from the defendant and awarded to him, and that the defendant be enjoined from removing the child beyond the jurisdiction of the court pending a hearing on the petition. Plaintiff alleged that the defendant had neglected the child and that she was morally unfit to have her custody.
The petition also alleged that the parties were married in Gonzales, Texas, on August 10, 1963; that there was one child of this marriage, Lisa Michelle Poole, born on May 14, 1964; and that on January 25, 1965, by a decree entered by the District Court of Gonzales County, *443 Texas, the defendant was granted a divorce from the plaintiff and she was awarded the custody of their infant child.
After the parties separated the plaintiff moved to Virginia and resided with his parents in Albemarle County.  During the month of July, 1966, the mother and the child came to Charlottesville to live.  With the consent of the mother, the child spent considerable time with the father, and at the time the petition was filed the father had the actual physical custody of the child.
The day after the defendant was served with notice of the petition and the injunction decree prohibiting her from removing the child beyond the court's jurisdiction she appeared, by counsel and in person, in the court below.  Upon defendant's motion to give full faith and credit to the Texas decree, she was awarded temporary custody of the child pending a hearing on the merits.  Almost immediately thereafter the defendant left Virginia, taking the child with her, and she has not returned.
On the day the case was set for a hearing on its merits, counsel filed a plea to dismiss plaintiff's petition on the ground that the Juvenile and Domestic Relations Court of Charlottesville had exclusive original jurisdiction of the question before the court.  The trial court overruled the motion and after hearing evidence entered a decree awarding the custody of the infant child to the plaintiff.
The sole question for our determination is whether the corporation court had jurisdiction to award custody of the infant child to the plaintiff.  The answer is found in Code || 16.1-158(1)(e) and (j), and 16.1-161. [1]
The pertinent parts of | 16.1-158, Code of 1950, as amended, 1960 Repl. Vol., provide as follows:
}"* * * Except as hereinafter provided, each juvenile and domestic relations court shall have, within the limits of the territory for which it is created, exclusive original jurisdiction * * * over all cases, matters and proceedings involving:"
(1)  The custody, support, control or disposition of a child:
* * *
(e)  whose custody or support is a subject of controversy, provided, however, that in such cases jurisdiction shall be concurrent *444 with and not exclusive of courts having equity jurisdiction, as provided in | 16.1-161 hereof;
* * *
(j)  whose condition or situation is alleged to be such that his welfare demands adjudication as to his disposition, control and custody, provided that jurisdiction in such cases shall be concurrent with and not exclusive of that of courts having equity jurisdiction, as provided in | 16.1-161 hereof.""
The pertinent part of | 16.1-161, Code of 1950, 1960 Repl. Vol., reads as follows:
{"Nothing contained in this law shall deprive any other court of the concurrent jurisdiction to determine the custody of children upon a writ of habeas corpus under the law, or to determine the custody or guardianship of children when such custody or guardianship is incidental to the determination of causes pending in such courts, provided that when a court of record shall have taken jurisdiction thereof the juvenile and domestic relations court shall be divested of such jurisdiction.  * * *"
It is evident that the purpose of Code | 16.1-158 was to vest in juvenile and domestic relations courts the widest possible authority and power to deal with matters touching the care and custody of infants.     Lowe     Grasty, 203 Va. 168, 172, 173, 122 S.E.2d 867, 870 (1961).  It is also evident, as indicated by the language of | 16.1-161, that it was not the purpose of the legislature to divest courts of equity of all power to determine the custody of children.  Under the latter section a court of record has concurrent jurisdiction to determine the custody of children (1) upon a writ of habeas corpus, and (2) in a suit in equity when custody is incidental to the determination of the cause.
Here the plaintiff did not seek a change in custody in the corporation court upon a writ of habeas corpus, nor was the question of custody incidental to a cause pending in that court.  Thus it follows that the corporation court did not have jurisdiction under the provisions of Code | 16.1-161 to entertain the petition seeking a change in custody in the present case.
Plaintiff says that since the juvenile and domestic relations court *445 had no power to issue an injunction pending a hearing of the cause on its merits, he had no adequate remedy at law and the court of equity had inherent jurisdiction to entertain his petition to grant the relief requested.
He relies on    McClaugherty     McClaugherty,    180 Va. 51, 21 S.E.2d 761 (1942), to support his position.  There an infant filed a bill of complaint in the circuit court praying that her father be required to support her.  The father contended that the juvenile and domestic relations court, established under Chapter 80 of the Code, had original and exclusive jurisdiction to compel a parent to support and maintain his minor child.  We held that the circuit court had jurisdiction to enter the requested decree since the juvenile and domestic relations court had no power to give adequate and complete relief.  It could merely jail or fine the father, neither of which would support the daughter.
McClaugherty    does not control the present case.  Here the principal relief sought was the change in custody of the infant child.  The prayer for the injunction was merely ancillary to the relief sought.  It is not the prayer for injunction that confers jurisdiction, but the ultimate relief sought.  See Winston     Midlothian, Etc., Co.,    61 Va. (20 Gratt.) 686, 690 (1871); Lile's Equity Pleading and Practice (Meade), Injunction Suits, | 339, p. 196.  The juvenile and domestic relations court had original exclusive jurisdiction of the question of custody and the power to grant adequate and complete relief to the plaintiff.  The corporation court had no inherent power to grant custody of the infant child to the plaintiff.  Hence the decree awarding custody to the plaintiff is void.
For the reasons stated, the judgment of the corporation court is reversed and the cause dismissed.
Reversed and dismissed.
NOTES
[1]    Neither party relies upon Code | 31-15, Code of 1950, as amended, 1969 Repl. Vol., and so we do not determine its applicability to the present controversy.
