
899 N.E.2d 342 (2008)
PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Jason M. CLARK, Defendant-Appellant.
No. 3-07-0201.
Appellate Court of Illinois, Third District.
November 17, 2008.
*343 Melissa Maye, Office of State Appellate Defender, Ottawa, IL for Appellant.
Terry A. Mertel, Deputy Director State's Attorneys Appellate Prosecutor, Ottawa, James Glasgow, State's Attorney, Joliet, Richard T. Leonard, State's Attorneys Appellate Prosecutor, Ottawa, IL, for Appellee.
Justice LYTTON delivered the Opinion of the court:
Defendant entered into a negotiated plea of guilty to unlawful possession of a weapon by a felon and reckless discharge of a firearm. Pursuant to the plea agreement, the trial court recommended defendant for impact incarceration. Defendant filed a postconviction petition alleging that (1) his trial counsel, a Will County assistant public defender, was ineffective for failing to quash his outstanding warrants *344 and advising him that he was eligible for impact incarceration, and (2) another Will County assistant public defender was ineffective for failing to file a motion to withdraw his guilty plea. The trial court dismissed defendant's postconviction petition. We reverse and remand.

BACKGROUND
On November 22, 2002, defendant was charged with unlawful possession of a weapon by a felon (720 ILCS 5/24-1.1(a) (West 2002)) and reckless discharge of a firearm (720 ILCS 5/24-1.5 (West 2002)). An assistant public defender from the Will County Public Defender's Office, Gabriel Guzman, was appointed to represent defendant. On May 12, 2006, defendant appeared in court with Guzman and entered into a negotiated plea of guilty to both charges. According to the negotiated plea, defendant was to be sentenced to eight years' imprisonment and recommended for the Department of Corrections Impact Incarceration Program, or boot camp.
Defendant signed a consent to impact incarceration, which stated that defendant was agreeing to participate in impact incarceration "after having received the advice and consent of [his] attorney, Gabriel Guzman." The trial court explained that he could only recommend defendant for impact incarceration; he could not require the Department of Corrections (Department) to place defendant in the program. The trial court also told defendant that he would have to serve eight years in prison if he was not accepted into or did not complete impact incarceration. Defendant said he understood. The trial court then accepted the plea agreement and entered a sentencing order imposing the agreed-upon sentence and recommending defendant for impact incarceration.
On February 13, 2007, defendant filed a postconviction petition and supporting affidavit. According to the petition, defendant informed Guzman that he had outstanding warrants before he pled guilty. Guzman told defendant that the warrants had been resolved and that he was eligible for impact incarceration. As a result of these representations, defendant pled guilty. Soon thereafter, defendant was transferred to the Stateville Receiving Center. A counselor at the receiving center informed defendant that there were still warrants pending against him, which made him ineligible for impact incarceration.
According to defendant's petition, on May 30, 2006, defendant asked his mother to request that Guzman file a motion to withdraw his guilty plea. On June 6, 2006, defendant received a letter from Assistant Public Defender Stewart C. Ferreira, which stated in pertinent part:
"* * * I understand that you wish to withdraw your plea because you fear that there may be an outstanding warrant for your arrest in Cook County, and that this outstanding warrant might affect your eligibility for Impact Incarceration, otherwise known as Boot Camp.
Mr. Guzman, who represented you on this plea, is on sick leave and the date of his return is unknown. I have looked into this matter and I respond as follows.
There does not appear to be any warrants outstanding at this time. However, understand that after entry of a knowing, voluntary and intelligent plea, the fact that there may be an outstanding warrant issued against you is not by itself, a basis to withdraw a guilty plea."
Ferreira did not file a motion to withdraw defendant's guilty plea. On December 7, 2006, defendant filed pro se motions to quash the outstanding warrants that were pending against him in Cook County. The Circuit Court of Cook County entered orders *345 on December 27, 2006, quashing and recalling all of defendant's outstanding warrants.
In his postconviction petition, defendant alleged that Guzman's representation that he had resolved defendant's outstanding warrants prior to him pleading guilty was untrue and prejudicial because the warrants made him ineligible for impact incarceration, which would have required him to serve only 120 to 180 days, rather than eight years in prison. Defendant also alleged that Ferreira's failure to file a motion to withdraw his guilty plea was unreasonable and prejudicial. The trial court dismissed defendant's petition, finding that it was "frivolous and patently without merit."

ANALYSIS
The Post-Conviction Hearing Act (Act) provides defendants with a means of challenging their convictions or sentences for constitutional violations. 725 ILCS 5/122-1 et seq. (West 2006). A pro se postconviction petition must be liberally construed in a defendant's favor. See People v. Correa, 108 Ill.2d 541, 92 Ill.Dec. 496, 485 N.E.2d 307, 308 (1985).
In the first stage of the adjudication of a postconviction petition, the circuit court determines whether the postconviction petition is "frivolous or patently without merit." 725 ILCS 5/122-2.1(a)(2) (West 2006). To survive dismissal at this stage, the petition must only present "the gist of a constitutional claim." People v. Gaultney, 174 Ill.2d 410, 418, 221 Ill.Dec. 195, 675 N.E.2d 102, 106 (1996). In deciding whether the petitioner has done so, the trial court must accept all well-pleaded facts as true and determine whether the petition is legally sufficient. See People v. Smith, 326 Ill. App.3d 831, 839, 260 Ill.Dec. 462, 761 N.E.2d 306, 315 (2001). If the petition survives the first stage, the petition proceeds to the second stage where the court may appoint counsel to amend the petition. 725 ILCS 5/122-4 (West 2006); People v. Boclair, 202 Ill.2d 89, 100, 273 Ill.Dec. 560, 789 N.E.2d 734, 741 (2002). At the third stage, the trial court conducts an evidentiary hearing on the merits of the petition. 725 ILCS 5/122-6 (West 2006). We review a trial court's first stage dismissal of a postconviction petition de novo. See People v. Edwards, 197 Ill.2d 239, 246, 258 Ill.Dec. 753, 757 N.E.2d 442, 447 (2001).

I. Ineffective Assistance of Guzman
Defendant argues that he sufficiently alleged that his guilty plea was involuntary because it was based on misrepresentations by his trial counsel that he had no outstanding warrants. In fact, defendant had pending warrants that made him ineligible for impact incarceration.
Due process requires that guilty pleas be voluntary and knowing. Young, 355 Ill.App.3d at 322, 291 Ill.Dec. 45, 822 N.E.2d at 924. That a defendant entered a guilty plea because of erroneous advice from counsel does not necessarily destroy the voluntary nature of the plea. See People v. Pugh, 157 Ill.2d 1, 14, 191 Ill. Dec. 10, 623 N.E.2d 255, 261 (1993). A plea based on reasonably competent advice is a voluntary plea not open to attack on the grounds that counsel erred in his judgment. People v. Palmer, 162 Ill.2d 465, 475, 205 Ill.Dec. 506, 643 N.E.2d 797, 801 (1994). However, a defendant's guilty plea, made in reliance on counsel's erroneous advice, is involuntarily if the defendant did not receive effective assistance of counsel. See Pugh, 157 Ill.2d at 14, 191 Ill. Dec. 10, 623 N.E.2d at 261; Correa, 108 Ill.2d at 549, 92 Ill.Dec. 496, 485 N.E.2d at 310.
To establish that trial counsel was ineffective, defendant must demonstrate that (1) counsel's performance was deficient; *346 and (2) there is a reasonable probability that, but for counsel's errors, he would not have pleaded guilty and would have insisted on going to trial. Young, 355 Ill.App.3d at 322, 291 Ill.Dec. 45, 822 N.E.2d at 924. The standard for competence in guilty plea cases is not whether counsel's advice was correct, but whether defense counsel's advice was within the range of competence demanded of attorneys in criminal cases. Pugh, 157 Ill.2d at 17, 191 Ill.Dec. 10, 623 N.E.2d at 262. Where defense counsel's advice is based on a misapprehension of the law, it falls outside the range of competence demanded of attorneys in criminal cases. See Pugh, 157 Ill.2d at 19, 191 Ill.Dec. 10, 623 N.E.2d at 263; People v. Curry, 178 Ill.2d 509, 529, 227 Ill.Dec. 395, 687 N.E.2d 877, 887 (1997). If defense counsel affirmatively provides "unequivocal, erroneous, misleading representations" about the consequences of a plea, this may amount to ineffective assistance that renders a defendant's plea involuntary. See Correa, 108 Ill.2d at 552, 92 Ill.Dec. 496, 485 N.E.2d at 311; Young, 355 Ill.App.3d at 323, 291 Ill.Dec. 45, 822 N.E.2d at 925.
A postconviction petition raises the gist of an ineffective assistance claim if it contains facts showing that defendant pled guilty based on defense counsel's misrepresentations that he was eligible for benefits that would reduce his time of incarceration. See People v. Stewart, 381 Ill. App.3d 200, 203, 320 Ill.Dec. 317, 887 N.E.2d 461, 464 (2008); Young, 355 Ill. App.3d at 325, 291 Ill.Dec. 45, 822 N.E.2d at 927; People v. Owsley, 66 Ill.App.3d 234, 238-39, 22 Ill.Dec. 795, 383 N.E.2d 271, 274-75 (1978). In Stewart, defendant alleged in his postconviction petition that he pled guilty because his trial counsel erroneously told him that he was eligible for day-for-day good conduct credit and might only have to serve 50% of his sentence when, in fact, he was statutorily required to serve 85% of his sentence. Stewart, 381 Ill.App.3d at 201, 320 Ill.Dec. 317, 887 N.E.2d at 462. The appellate court ruled that "[d]efendant's contention that counsel gave him wrong advice and he relied on that advice is sufficient under the Act to entitle him to an evidentiary hearing." Stewart, 381 Ill.App.3d at 206, 320 Ill.Dec. 317, 887 N.E.2d at 467; see also Young, 355 Ill.App.3d at 324, 291 Ill.Dec. 45, 822 N.E.2d at 926 (defendant's allegations that counsel incorrectly advised him that he would receive good-time credits and work release credits if he pled guilty were sufficient to avoid dismissal of postconviction petition).
Finally, in Owsley, the defendant alleged in her postconviction petition that she pled guilty because her counsel erroneously advised her that she would be eligible for parole in five years and weekend furloughs and work release in one year. Owsley, 66 Ill.App.3d at 236, 22 Ill.Dec. 795, 383 N.E.2d at 273. In reviewing the trial court's dismissal of defendant's postconviction petition, this court explained:
"Certainly, a defendant ought not to be misled, in any way, into entering a plea of guilty. It is extremely important to a defendant to know when he or she is eligible for parole or other `freedom-related' benefits before that defendant can decide whether to plead guilty." Owsley, 66 Ill.App.3d at 237, 22 Ill.Dec. 795, 383 N.E.2d at 273.
We found that it was error for the trial court to dismiss defendant's petition. Owsley, 66 Ill.App.3d at 238-39, 22 Ill.Dec. 795, 383 N.E.2d at 274-75.
Here, defendant filed a postconviction petition claiming that he pled guilty because Guzman advised him that all of his arrest warrants had been quashed, thereby making him eligible for 120 to 180 days of impact incarceration. In fact, Guzman failed to quash several of defendant's warrants, *347 which caused the Department to deny defendant impact incarceration.
The State contends that defendant's postconviction petition was properly dismissed because defendant's outstanding warrants did not make him ineligible for impact incarceration. We reject the State's argument for two reasons. First, the State is attempting to contradict the facts presented in defendant's petition, which it cannot do in the first stage of a postconviction proceeding. See Smith, 326 Ill.App.3d at 839, 260 Ill.Dec. 462, 761 N.E.2d at 315. Defendant's affidavit states that a counselor at the Stateville Receiving Center informed him that he had several outstanding warrants, which made him ineligible for impact incarceration. At this stage of the proceeding, we must accept defendant's allegations as true. See Smith, 326 Ill.App.3d at 839, 260 Ill.Dec. 462, 761 N.E.2d at 315. Second, the Unified Code of Corrections specifically provides that "[t]he Department may consider * * * whether the committed person has any outstanding detainers or warrants" in determining his eligibility for impact incarceration. 730 ILCS 5/5-8-1.1(b) (West 2006). Defendant alleges that the warrants were considered by the Department and were critical to its refusal to give defendant impact incarceration.
Defendant's allegations that he pled guilty based on Guzman's erroneous advice and misrepresentations about whether he had outstanding warrants and was eligible for impact incarceration present the gist of an ineffective assistance claim. See Stewart, 381 Ill.App.3d 200, 203, 320 Ill.Dec. 317, 887 N.E.2d 461, 464 (2008); Young, 355 Ill.App.3d at 325, 291 Ill.Dec. 45, 822 N.E.2d at 927; Owsley, 66 Ill.App.3d 234, 238-39, 22 Ill.Dec. 795, 383 N.E.2d 271, 274-75. Thus, we reverse the trial court's dismissal of defendant's postconviction petition. Defendant is entitled to proceed to the second stage on his claim that his trial counsel was ineffective and that, as a result, his guilty plea was not voluntary.

II. Ineffective Assistance of Ferreira
Defendant also argues that he presented the gist of an ineffective assistance claim against Ferreira because Ferreira did not file a motion to withdraw his guilty plea. The State responds that defendant's ineffective assistance claim against Ferreira is baseless because (1) defendant and Ferreira did not have an attorney-client relationship, and (2) defendant had no valid grounds for withdrawal of his guilty plea.

A. Attorney-Client Relationship
The attorney-client relationship is consensual and arises when both the attorney and the client have consented to its formation. Simon v. Wilson, 291 Ill. App.3d 495, 509, 225 Ill.Dec. 800, 684 N.E.2d 791, 801 (1997). The client must manifest his authorization that the attorney act on his behalf, and the attorney must indicate his acceptance of the power to act on the client's behalf. Simon, 291 Ill.App.3d at 509, 225 Ill.Dec. 800, 684 N.E.2d at 801. An attorney's duty to a client is measured by the representation sought by the client and the scope of the authority conferred. Simon, 291 Ill. App.3d at 509, 225 Ill.Dec. 800, 684 N.E.2d at 801.
Here, defendant's mother attempted to contact Guzman to ask him to file a motion to withdraw defendant's guilty plea. In response, Assistant Public Defender Ferreira sent defendant a letter advising him that Guzman was ill, and stating that he had looked into defendant's case. Ferreira told defendant that he would not file a motion to withdraw the plea because he did not find any outstanding warrants against defendant and believed that the existence of outstanding warrants was not a valid basis for withdrawing defendant's guilty plea.
*348 We find that an attorney-client relationship existed. Defendant authorized legal counsel to act on his behalf to withdraw his guilty plea. Defendant intended for Guzman to file the motion to withdraw. Guzman was not available, so Ferreira responded to defendant's request. By responding to defendant and advising him about his case, Ferreira accepted the power to act on defendant's behalf. Thus, defendant and Ferreira entered into a consensual attorney-client relationship. See Simon, 291 Ill.App.3d at 509, 225 Ill.Dec. 800, 684 N.E.2d at 801.

B. Ferreira's Representation of Defendant
Now, we must determine if Ferreira provided effective assistance to defendant when he told him that he had no warrants pending against him and that there was no basis to withdraw his guilty plea.
To establish that a defendant was deprived of effective assistance of counsel, a defendant must establish both that his attorney's performance was deficient and that he suffered prejudice as a result. Pugh, 157 Ill.2d at 14, 191 Ill.Dec. 10, 623 N.E.2d at 261. Defense counsel's performance is deficient if it falls below an objective standard of reasonableness. See Pugh, 157 Ill.2d at 17, 191 Ill.Dec. 10, 623 N.E.2d at 262. A defendant establishes prejudice by showing that, but for counsel's errors, there is a reasonable probability that the result of the proceeding would have been different. People v. Houston, 229 Ill.2d 1, 4, 321 Ill.Dec. 702, 890 N.E.2d 424, 426 (2008).
Leave to withdraw a plea of guilty is not granted as a matter of right, but as required to correct a manifest injustice under the facts involved. People v. Hillenbrand, 121 Ill.2d 537, 545, 118 Ill. Dec. 423, 521 N.E.2d 900, 903 (1988). Whether to permit a guilty plea to be withdrawn is within the sound discretion of the trial court. Pugh, 157 Ill.2d at 13, 191 Ill.Dec. 10, 623 N.E.2d at 261; Hillenbrand, 121 Ill.2d at 545, 118 Ill.Dec. 423, 521 N.E.2d at 903. Such discretion should be exercised liberally. Pugh, 157 Ill.2d at 13, 191 Ill.Dec. 10, 623 N.E.2d at 261. When a guilty plea was entered because of a misapprehension of the law or as a consequence of misrepresentations by counsel, the court should permit withdrawal of the guilty plea. Pugh, 157 Ill.2d at 13-14, 191 Ill.Dec. 10, 623 N.E.2d at 261.
Defendant has alleged sufficient facts to establish that Ferreira's representation fell below an objective standard of reasonableness. First, Ferreira was incorrect in his assertion that defendant did not have any outstanding warrants. Defendant had several warrants pending against him in Cook County, which were later quashed. Additionally, Ferreira's contention that defendant did not have a legal basis for withdrawal of his guilty plea was legally incorrect. Guzman's misrepresentations to defendant about the status of his warrants and his eligibility for impact incarceration formed a sufficient basis for defendant to withdraw his guilty plea. See Pugh, 157 Ill.2d at 13-14, 191 Ill.Dec. 10, 623 N.E.2d at 261. Because Ferreira's advice to defendant was based on a misapprehension of law and facts, it was deficient. See Pugh, 157 Ill.2d at 19, 191 Ill.Dec. 10, 623 N.E.2d at 263; Curry, 178 Ill.2d at 529, 227 Ill.Dec. 395, 687 N.E.2d at 887.
Defendant also alleged sufficient facts to establish that Ferreira's representation prejudiced him. Trial courts liberally allow a defendant to withdraw a guilty plea to correct a manifest injustice, particularly when the plea was entered because of a misapprehension of the law or misrepresentations by counsel. See Pugh, 157 Ill.2d at 13-14, 191 Ill.Dec. 10, 623 N.E.2d *349 at 261. Here, defendant entered his guilty plea because Guzman told him that he had no outstanding warrants and, therefore, would be eligible for impact incarceration. Because impact incarceration was a key inducement to defendant's plea and defendant had outstanding warrants that made him ineligible for impact incarceration, a trial court would likely have allowed defendant to withdraw his guilty plea. See Pugh, 157 Ill.2d at 13-14, 191 Ill.Dec. 10, 623 N.E.2d at 261. Thus, Ferreira's failure to file a motion to withdraw defendant's guilty plea prejudiced defendant.
Because defendant has stated the gist of an ineffective assistance claim against Ferreira, the trial court erred in dismissing defendant's postconviction petition. Defendant should be allowed to proceed to the second stage under the Act.

CONCLUSION
The judgment of the Circuit Court of Will County is reversed and remanded.
Reversed and remanded.
McDADE, P.J., and O'BRIEN, J., concurring.
