
776 S.W.2d 191 (1989)
Bryan O'Neil COMER, Appellant,
v.
The STATE of Texas, Appellee.
Nos. 161-88, 162-88.
Court of Criminal Appeals of Texas, En Banc.
June 28, 1989.
Rehearing Denied September 13, 1989.
*192 James R. Moore, Beverly Bass, Longview, for appellant.
Gregory W. Neeley, Longview, attorney pro tem and Robert Huttash, State's Atty., Austin, for State.
Before the court en banc.

OPINION ON APPELLANT'S PETITION FOR DISCRETIONARY REVIEW
CLINTON, Judge.
In separate indictments appellant was charged with murder of an elderly couple, committed in the course of robbery. V.T. C.A. Penal Code, § 19.03(a)(2). Prosecution of the two offenses was consolidated and the jury found appellant guilty of both. As he was a sixteen year old juvenile at the time the offenses were committed, appellant was assessed life sentences, to be served concurrently. V.T.C.A. Penal Code, § 8.07(d). His convictions were upheld by the Twelfth Court of Appeals, in an unpublished opinion. Comer v. State, Nos. 12-87-00032-CR & 12-87-00033-CR (Tex.App. Tyler, delivered January 15, 1988).
The facts pertinent to our review are simple and undisputed. At 6:24 p.m. on February 13, 1986, six days following commission of the offense, appellant was arrested at his home, pursuant to a warrant, by three officers of the Gregg County Sheriff's Department. After a brief stop at departmental offices to pick up necessary waiver and statement forms, the officers *193 proceeded to take appellant to the home of Justice of the Peace Robert Malcolm, arriving shortly after 7:00 p.m. Malcolm cautioned appellant in compliance with V.T.C.A., Family Code, § 51.09(b)(1). By 7:30 p.m. the officers had brought appellant back to the Sheriff's Department. There he gave a full confession, which was committed to writing. At 9:16 p.m. appellant was returned to Malcolm's home. He signed the confession in Malcolm's kitchen, the officers remaining in the next room. Shortly after 9:30 p.m., the officers transported appellant to the juvenile detention center. Appellant's confession was ultimately admitted at trial, over his objection.
Appellant contended on appeal, inter alia, that because the arresting officers failed to comply with the provisions of V.T. C.A. Family Code, § 52.02(a), his confession was the product of an illegal detention, and should have been suppressed. That statute provides, in relevant part:
"(a) A person taking a child into custody, without unnecessary delay and without first taking the child elsewhere, shall do one of the following:
* * * * * *
(2) bring the child before the office or official designated by the juvenile court;
(3) bring the child to a detention facility designated by the juvenile court[.]"[1]
The court of appeals rejected appellant's contention, simply holding that "admissibility of a statement by a detained juvenile is controlled by section 51.09(b).... [which] governs the temporary detention for the purpose of questioning as in the instant case." Finding the dictates of § 51.09(b), supra, to have been followed, the court of appeals held appellant's written confession was properly admitted.
We granted appellant's petition for discretionary review to decide whether a confession taken before the requisites of § 52.02(a), supra, have been met must be suppressed, thus resolving an apparent conflict between this and other courts of appeals, viz: In re D.M.G.H., 553 S.W.2d 827 (Tex.Civ.App.-El Paso 1977, no writ); In re L.R.S., 573 S.W.2d 888 (Tex.Civ.App. Houston [1st] 1978, no writ); Littlefield v. State, 720 S.W.2d 254 (Tex.App.-Beaumont 1986, pet. ref'd); Salas v. State, 756 S.W.2d 832 (Tex.App.-Corpus Christi 1988, no pet.). See Tex.R.App.Pro., Rule 200(c)(2) & (1), respectively.

V.T.C.A. Family Code, § 52.02(a)
In construing provisions of Title 3 of the Family Code we must be mindful of the sometimes competing purposes it is meant to serve, viz: to protect the public from the unlawful acts of children while concomitantly insulating those children from the stigma of criminality and providing for their welfare and edificationand "to achieve the foregoing purposes in a family environment whenever possible, separating the child from his parents only when necessary for his welfare or in the interest of public safety...." V.T.C.A. Family Code, § 51.01.
§ 52.02(a), supra, has remained unchanged since it appeared with the advent of the Family Code in 1973. "The provisions of subsection (a) do not materially change the prior Texas law" as found in former V.T.C.S., art. 2338-1, § 11. Dawson, Delinquent Children and Children in Need of Supervision: Draftman's Comments to Title 3 of the Texas Family Code, 5 Tex.Tech.L.Rev. 509, at 541 (1974). That provision mandated that:
"... If not [released to a parent, guardian or another who can insure his appearance at subsequent proceedings, a child taken into custody by an officer] shall be placed in the custody of a probation officer or other person designated by the court or be taken immediately to the probation department, the court, or to the place of detention designated by the court ... The child shall forthwith be brought to the Judge, who shall order the child's release, or his temporary detention either in the compartment provided for the custody of juveniles, or by a *194 suitable person or agency as in the judgment of the court may seem proper."
Considering its predecessor, see V.T.C.A. Government Code, § 311.023(4), it is reasonable to construe § 52.02(a), supra, to mean what it certainly seems to saythat its provisions will be complied with "immediately" and "forthwith" upon taking a child into custody.
In keeping with the objective of achieving its goals while maintaining the integrity of the family environment, Title 3 evinces a decided presumption against the prolonged detention of children taken into custody under its provisions. § 52.01(b), supra, provides, for example, that a taking of a child into custody is not an arrest except for purposes of determining the legal validity of the seizure itself. This same provision authorizes a law enforcement officer, pursuant to approved guidelines, to release the child with a warning, which may or may not indicate further proceedings. § 52.01(c), supra. Thus, where in the officer's guided discretion it is appropriate, the child should only be detained, if at all, for as long as it takes the officer to issue the warning. "When possible, custody should be avoided altogether pending court hearing." Dawson, supra, at 540. Where the officer deems it necessary to take the child into custody, § 52.02(a), supra, of course, dictates what he must then do "without unnecessary delay and without first taking the child anywhere else[.]"[2] It seems the clear intent of the statutory scheme as a whole that from this point on, decision as to whether further detention is called for is to be made, not by law enforcement personnel, but by "the intake or other authorized officer of the court[,]" V.T.C.A. Family Code, § 53.02, see also §§ 52.04 & 53.01, with investigative aid of law enforcement officers when requested, § 52.04(b), supra, or by the juvenile court itself, V.T. C.A. Family Code, § 54.01. Moreover, once in the constructive custody of the juvenile court, the child may be further detained "only if" certain facts are found to be true, first by the intake or other authorized officer of the court, and then again, within a prescribed period, by the court itself.[3] There is some indication the statutory bias *195 in favor of speedy resolution of the detention decision is meant to obviate both the need for and the stigma of a bail bond system for juveniles. Dawson, supra, at 542, 557. Certainly that view is consistent with the general purposes enunciated in § 51.01, supra. In any event it appears that in 1973, apart from certain exceptions, see n. 2 ante, the Legislature intended to restrict involvement of law enforcement officers to the initial seizure and prompt release or commitment of the juvenile offender in accordance with § 52.02(a), supra.

V.T.C.A. Family Code, § 51.09(b)
Also in the original version of the Family Code as enacted in 1973 was § 51.09, supra, governing waiver of rights of a child who is subjected to juvenile proceedings. This provision required the concurrence of an attorney before the child could validly waive "any right granted to a child by this title or by the constitution or laws of this state or of the United States[.]" This requirement was evidently intended to apply to the child's federal constitutional right to silence and privilege against self incrimination. Dawson, supra, at 525. It was so construed. E.g., In re R.E.J., 511 S.W.2d 347 (Tex.Civ.App.-Houston [1st] 1974, no writ); In re F.G., 511 S.W.2d 370 (Tex.Civ. App.-Amarillo 1974, no writ); In re V.R.S., 512 S.W.2d 350 (Tex.Civ.App.- Amarillo 1974, no writ); Lovell v. State, 525 S.W.2d 511 (Tex.Cr.App.1975).
The very next legislature amended § 51.09, supra, however, adding a subsection (b) to remove the privilege against self incrimination from among those legal rights for which a juvenile needs the concurrence of counsel to waive. Acts 1975, 64th Leg., p. 2154, ch. 693, § 9, eff. Sept. 1, 1975. Pursuant to this amendment, a written statement of a child, reflecting that it was given after certain warnings from a magistrate, "is admissible in evidence in any future proceeding concerning the matter about which the statement was given if... the child is in a detention facility or other place of confinement or in the custody of an officer [.]"[4] The court of appeals effectively held that the underscored language carves out an exception to the dictates of § 52.02, supra, allowing law enforcement officers to hold juveniles for as *196 long as it takes to secure a statement in conformance with the stringent warning requirements of § 51.09(b), supra. No other court of appeals has come to this conclusion,[5] and we decline to do so now.
Title 3 contemplates that once he has found cause initially to take a child into custody and makes the decision to refer him to the intake officer or other designated authority, a law enforcement officer relinquishes ultimate control over the investigative function of the case. §§ 52.02(a) & 52.04(a), both supra; see also, V.T.C.A. Family Code, § 54.02(d). In our view the Legislature intended that the officer designated by the juvenile court make the initial decision whether to subject a child to custodial interrogation. He can take a statement himself, consistent with § 51.09(b)(1), supra, at the detention facility, or, pursuant to § 52.04(b), he can refer the child back to the custody of law enforcement officers to take the statement. This construction gives effect to the Legislature's revised attitude that a juvenile is competent to waive his privilege against self incrimination without recourse to counsel, while preserving in full its original intention that involvement of law enforcement officers be narrowly circumscribed. Furthermore, this construction best serves to balance the competing purposes announced in § 51.01, supra. By interpreting § 51.09(b)(1), supra, to allow interrogation of the child, but only where deemed appropriate by the officer designated by the court, "consistent with the protection of the public interest," we avoid the "taint of criminality" inherent in interrogation conducted at the unsupervised discretion of law enforcement officers. § 51.01(3), supra. See Darden v. State, 629 S.W.2d 46, 53 (Tex.Cr.App.1982) (Clinton, J., concurring).
We hold that in detaining appellant for the approximately three hours it took to obtain his confession, the officers in this cause violated § 52.02(a), supra, notwithstanding the provisions of § 51.09(b)(1), supra. The court of appeals erred in holding otherwise.

Article 38.23, V.A.C.C.P.
This Court has recently reaffirmed "that issues involving substantive rights of pre-transfer juveniles, such as legality of detention or a confession, though raised in the criminal forum, shall be controlled by applicable provisions of the Family Code." Griffin v. State, 765 S.W.2d 422, at 427 (Tex.Cr.App.1989). See also Vasquez v. State, 739 S.W.2d 37, at 44 (Tex.Cr.App. 1987); Lovell v. State, supra. Upon his transfer for criminal proceedings, treating appellant as an adult in accordance with V.T.C.A. Family Code, § 54.02(h), means that his confession, if illegally taken, could not have been admitted against him in his criminal trial, consistent with Article 38.23, V.A.C.C.P. We have also held that an otherwise valid confession following a detention that is illegal as a matter of state law will not be excludable under Article 38.23, supra, where it is determined that the taint of the illegality has dissipated by the time the confession was taken. Bell v. State, 724 S.W.2d 780, 787 (Tex.Cr.App.1986). We hold that the taint of appellant's detention, unlawful under § 52.02(a), supra, had not dissipated by the time appellant gave his confession.
The record reflects appellant was fully cautioned by Justice of the Peace Malcolm before he gave his statement. *197 However, every other factor in the attenuation of taint analysis adopted in Bell v. State, supra, at 788, militates in favor of our conclusion appellant's confession was illegal: it was taken immediately upon his having been taken into custody, without intervening circumstances, by officers whose exclusive reason for failing to comply with § 52.02(a), supra, was to obtain the statement. We do not imply that the officers willfully violated the law in this case. Nevertheless, in taking upon themselves the decision to interrogate appellant, the officers usurped a function which Title 3 vests in the officer designated by the juvenile court. We cannot say with any degree of confidence that, had appellant been transported "forthwith" to the custody of the juvenile detention facility, where he may have had access to, if not counsel, at least his parents, see V.T.C.A. Family Code, § 51.12(b), he would still have chosen to confess his crime. Appellant's statement should have been suppressed under Article 38.23, supra.

Tex.R.App.Pro., Rule 81(b)(2)
Because the court of appeals found no error was committed in admitting appellant's statement into evidence at the consolidated trial, it did not examine the record with a view to determining whether admission of the statement made any contribution to his convictions or punishment, as directed by Tex.R.App.Pro., Rule 81(b)(2). Having ruled the statement was erroneously admitted, we remand the causes to that court for a determination of the harmfulness of the error. E.g., Hammett v. State, 713 S.W.2d 102 (Tex.Cr.App.1986).
Accordingly, the judgment of the court of appeals as to each cause is reversed and they are remanded for further proceedings not inconsistent with this opinion.
NOTES
[1]  The record reflects that Justice of the Peace Malcolm was not a designated official of the juvenile court. (All emphasis supplied unless otherwise indicated.)
[2]  So far as we can discern, Title 3 contemplates two possible exceptions to this mandate. First, if it is the officer's intention to "bring the child before the office or official designated by the juvenile court[,]" § 52.02(a)(2), supra, "to the extent authorized by the juvenile court ... [the officer] may take him to the police station to do the paper work on the case." Dawson, supra, at 541. Second, again pursuant to particular guidelines promulgated by the law enforcement agency and ratified by the juvenile court, an officer may in his discretion dispose of a case without referral to the court. V.T.C.A. Family Code, § 52.03. This seems to authorize at least a brief period of law enforcement custody absent strict adherence to the requirements of § 52.02(a), supra. Dawson, supra, at 543.
[3]  The intake officer shall make his decision as to detention "immediately." § 53.02(a), supra. If the intake officer believes further detention is in order, a detention hearing before the juvenile court "shall be held promptly," §§ 53.02(c) & 54.01(a), both supra. Under the original provisions, "promptly" was qualified to mean "not later than the next working day after [the child] was taken into custody." Id. By Acts 1975, 64th Leg., p. 2156, ch. 693, §§ 14 and 15, eff. Sept. 1, 1975, the Legislature amended § 54.01(a), supra, to require the detention hearing be held no later than the "second" working day, unless the child was taken into custody on a Friday or Saturday, in which event the "next" working day would still apply. § 53.02(c), supra, was belatedly amended to conform, see Acts 1981, 67th Leg., p. 291, ch. 115, § 1, eff. Aug. 31, 1981.

As originally enacted, both § 53.02(b) and §§ 54.01(e) set out as the criteria for deciding if further detention of the child is warranted, whether:
"(1) he is likely to abscond or be removed from the jurisdiction of the court;
(2) suitable supervision, care, or protection for him is not being provided by a parent, guardian, custodian, or other person; or
(3) he has no parent, guardian, custodian or other person able to return him to court when required."
Thus, the welfare of the public was not even considered in the detention decision of either the intake officer or the juvenile court until amendment of both statutes in Acts 1979, 66th Leg., p. 1102, ch. 518, §§ 1 & 2, eff. June 11, 1979, added the following criteria, to wit, whether:
"(4) he is accused of committing a felony offense and may be dangerous to himself or others if released; or
(5) he has previously been found to be a delinquent child or has previously been convicted of a penal offense punishable by a term in jail or prison and is likely to commit an offense if released."
[4]  The full provision of added subsection (b) reads:

"(b) Notwithstanding any of the provisions of Subsection (a) of this section, the statement of a child is admissible in evidence in any future proceeding concerning the matter about which the statement was given if:
(1) when the child is in a detention facility or other place of confinement or in the custody of an officer, the statement is made in writing and the statement shows that the child has at some time prior to the making thereof received from a magistrate a warning that:
(A) he may remain silent and not make any statement at all and that any statement he makes may be used in evidence against him;
(B) he has the right to have an attorney present to advise him either prior to any questioning or during the questioning;
(C) if he is unable to employ an attorney, he has the right to have an attorney to counsel with him prior to or during any interviews with peace officers or attorneys representing the state;
(D) he has the right to terminate the interview at any time;
(E) if he is 15 years of age or older at the time of the violation of a penal law of the grade of felony the juvenile court may waive its jurisdiction and he may be tried as an adult; and
(F) the statement must be signed in the presence of a magistrate by the child with no law enforcement officer or prosecuting attorney present. The magistrate must be fully convinced that the child understands the nature and contents of the statement and that the child is signing the same voluntarily. If such a statement is taken, the magistrate shall sign a written statement verifying the foregoing requisites have been met.
The child must knowingly, intelligently, and voluntarily waive these rights prior to and during the making of the statement and sign the statement in the presence of a magistrate who must certify that he has examined the child independent of any law enforcement officer or prosecuting attorney and determined that the child understands the nature and contents of the statement and has knowingly, intelligently, and voluntarily waived these rights.
(2) it be made orally and the child makes a statement of facts or circumstances that are found to be true, which conduct tends to establish his guilt, such as the finding of secreted or stolen property, or the instrument with which he states the offense was committed.
(3) the statement was res gestae of the delinquent conduct or the conduct indicating a need for supervision or of the arrest."
[5]  The court of appeals cited Matthews v. State, 677 S.W.2d 282 (Tex.App.-Fort Worth 1984), in support of its assertion that § 51.09(b), supra, "governs" the question of legality of detention of juveniles by law officers for purposes of taking a statement. It is true that in Matthews the Fort Worth Court of Appeals observed that "[s]ection 51.09(b) governs the temporary detention for the purpose of the questioning we have here." 677 S.W.2d at 283. But the questioning in Matthews occurred when Matthews was taken back into police custody, after having been delivered to the appropriate juvenile detention facility following his arrest the day before. Thus, Matthews does not present the potential conflict between §§ 52.02(a) and 51.09(b), both supra, involved in the instant case. See Comment, Out of the Mouths of Babes Ofttimes Come Confessions: An Assessment of Juvenile Confession Law Under the Texas Family Code, 16 Tex.Tech. L.Rev. 725, at 756-57 (1985).
