
452 S.E.2d 360 (1995)
Russell Wayne BROWNING
v.
COMMONWEALTH of Virginia.
Record No. 2454-92-3.
Court of Appeals of Virginia.
November 29, 1994.
*361 J. Patterson Rogers, III (Lawrence D. Gott, on brief), for appellant.
Robert H. Anderson, III, Asst. Atty. Gen. (James S. Gilmore, III, Atty. Gen., Richard B. Smith, Asst. Atty. Gen., on brief), for appellee.
Present: KOONTZ, ELDER and BRAY, JJ.
ELDER, Judge.
Russell Wayne Browning appeals his convictions for abduction, sodomy, rape, and robbery. On appeal he contends the trial court erred in (1) not letting him withdraw his pleas of nolo contendere before entry of final judgment based upon his contention that he was tricked by his counsel into entering his pleas; (2) failing to appoint new counsel for him; (3) allowing his counsel to testify at the hearing on his motion to withdraw his pleas; and (4) in finding that the evidence was sufficient to support a finding of guilt. Because appellant was denied his right to counsel when his attorney testified at the hearing, we reverse and remand to the trial court.
Shortly after 10:00 p.m. on March 15, 1992, the victim was assaulted in Danville by a man who pulled out a knife and told her to follow his instructions. After ordering the victim to drive him to a particular destination, the man forced the victim to perform oral sex on him, tried to anally penetrate the victim, and vaginally penetrated the victim. Subsequently, in a photo-identification, a live lineup, and in open court the victim identified appellant as her attacker, and appellant's fingerprints were recovered from the victim's automobile.
In May 1992, the grand jury for the City of Danville indicted appellant for having abducted with intent to defile and forcibly sodomizing, raping, and robbing the victim. The Public Defender for the City of Danville, Lawrence Gott, was appointed to represent appellant. On July 17, 1992, appellant entered pleas of nolo contendere, and the judge ascertained specifically that appellant was satisfied with Mr. Gott's services as counsel.[1] The judge subsequently heard the evidence as described above, found the appellant guilty on all counts, and continued the case for sentencing.
On September 4, 1992, a hearing was conducted to consider appellant's motions to withdraw his pleas and to relieve Mr. Gott of representing appellant. After hearing the reasons why appellant wanted Mr. Gott dismissed, the trial judge, sua sponte, called Mr. Gott as a witness. Mr. Gott was sworn and took the witness stand. At the conclusion of the hearing, the judge ruled that appellant was not entitled to withdraw his pleas of nolo contendere. At the completion of the hearing on appellant's motion to withdraw his pleas, the court appointed J. Patterson Rogers, III, to act as co-counsel for sentencing. On November 25, 1992, the circuit court sentenced appellant to serve twenty years in prison on the abduction charge. The court withheld imposition of sentence on the other three charges on the condition that appellant be of good behavior.


*362 I.
We hold that the trial court violated appellant's constitutional right to be represented by counsel when it required appellant's appointed counsel to testify under oath against appellant at the September 4 hearing.[2] In reaching this conclusion, we are guided by certain well-accepted constitutional principles.
Under the Sixth Amendment to the United States Constitution, "the accused shall enjoy the right ... to have the assistance of Counsel for his defense." The United States Supreme Court in Gideon v. Wainwright, 372 U.S. 335, 83 S.Ct. 792, 9 L.Ed.2d 799 (1963), ruled that the Sixth Amendment right to counsel is fundamental and essential to a fair trial and held that states are required to appoint counsel for indigent defendants. See also United States v. Cronic, 466 U.S. 648, 653, 104 S.Ct. 2039, 2043, 80 L.Ed.2d 657 (1984) ("An accused's right to be represented by counsel is a fundamental component of our criminal justice system"). "It has long been recognized in Virginia that the right to assistance of counsel is a fundamental one guaranteed to an accused by the Bill of Rights of the Virginia Constitution." Paris v. Commonwealth, 9 Va.App. 454, 459, 389 S.E.2d 718, 721 (1990). However, the appointment of counsel for an indigent defendant is constitutionally required only if imprisonment is actually imposed. Scott v. Illinois, 440 U.S. 367, 99 S.Ct. 1158, 59 L.Ed.2d 383 (1979); accord Sargent v. Commonwealth, 5 Va.App. 143, 360 S.E.2d 895 (1987).
The defendant's constitutional right to counsel attaches not only at the trial itself, but also at any critical stage where the "substantial rights" of the accused may be affected. See Hamilton v. Alabama, 368 U.S. 52, 82 S.Ct. 157, 7 L.Ed.2d 114 (1961). Thus, for example, counsel may be required at a police lineup, United States v. Wade, 388 U.S. 218, 87 S.Ct. 1926, 18 L.Ed.2d 1149 (1967), a preliminary hearing, Coleman v. Alabama, 399 U.S. 1, 90 S.Ct. 1999, 26 L.Ed.2d 387 (1970), a pleading stage, Rice v. Olsen, 324 U.S. 786, 65 S.Ct. 989, 89 L.Ed. 1367 (1945), sentencing, Townsend v. Burke, 334 U.S. 736, 68 S.Ct. 1252, 92 L.Ed. 1690 (1948), or appeal, Douglas v. California, 372 U.S. 353, 83 S.Ct. 814, 9 L.Ed.2d 811 (1963). See generally Grogg v. Commonwealth, 6 Va.App. 598, 371 S.E.2d 549 (1988); Shifflett v. Commonwealth, 5 Va.App. 277, 361 S.E.2d 783 (1987).
In the instant case, we hold that appellant, who was entitled to counsel because he was sentenced to twenty years in prison, "was effectively without counsel at the hearing and was forced to present his motion without the assistance of counsel." United States v. Ellison, 798 F.2d 1102, 1108 (7th Cir.1986), cert. denied, 479 U.S. 1038, 107 S.Ct. 893, 93 L.Ed.2d 845 (1987). The plea withdrawal hearing was a critical stage of the proceeding; when appellant's counsel took the stand to testify as to matters against his client's interests, appellant was deprived of his right to counsel and was effectively forced to present his motion to substitute new counsel on his own. Appellant's counsel recognized the fact that his client would be unrepresented if he testified, and he raised this issue with the trial judge. Despite counsel's concerns, the trial judge called counsel as a witness, questioned him, allowed appellant to question Mr. Gott, and allowed cross-examination by the attorney for the Commonwealth. Mr. Gott's testimony consumed twenty-four pages of the transcript of the hearing. "Thus, [appellant] not only was *363 without conflict-free representation at the hearing, but also was in effect without the assistance of counsel at all." Id.
Because we hold that appellant was denied his constitutional right to counsel at a critical stage of the proceeding when his counsel was called and sworn by the judge as a witness, we need not decide the other issues raised by appellant. We remand to the trial court for a re-hearing of appellant's motion to withdraw his nolo contendere pleas. Any action thereon must be taken in conformity with this opinion as it relates to appellant's right to representation.
Reversed and remanded.
NOTES
[1]  The record contains the colloquy between the trial judge and appellant. During the exchange, the judge ascertained, among other things: (1) that appellant understood the elements and burden of proof of the charges against him; (2) that appellant had discussed his case fully and completely with his counsel; (3) that appellant discussed his pleas with his counsel; (4) that appellant was entering his pleas knowingly and voluntarily; (5) that appellant understood that no jury trial would follow appellant's pleas; (6) that no one had coerced appellant into entering his pleas; (7) that appellant understood the possible sentencing penalties; (8) that appellant understood that he was waiving his right to appeal; and (9) that appellant was satisfied with the performance of his counsel.
[2]  We do not consider this claim to be one of "ineffective assistance of counsel." Claims of ineffective assistance of counsel may no longer be raised on direct appeal. Code § 19.2-317.1, which allowed direct appeal of such claims under certain circumstances, was repealed in 1990. 1990 Va. Acts, c. 74. See also Walker v. Mitchell, 224 Va. 568, 299 S.E.2d 698 (1983).

The effectiveness of counsel is a separate issue from the right to counsel, although the two have often been analyzed in the same cases. "The benchmark for judging any claim of ineffectiveness must be whether counsel's conduct so undermined the proper functioning of the adversarial process that the trial cannot be relied on as having produced a just result." Stamper v. Townley, 4 Va.App. 101, 105, 354 S.E.2d 802, 804 (1987) (quoting Strickland v. Washington, 466 U.S. 668, 686, 104 S.Ct. 2052, 2063-64, 80 L.Ed.2d 674 (1984)). Thus, once it is determined that counsel was in fact afforded to a defendant, a separate inquiry (and one that is not considered as part of this appeal) is whether that counsel's conduct provided reasonably effective assistance. See generally Payne v. Commonwealth, 5 Va.App. 498, 503, 364 S.E.2d 765, 767 (1988).
