
161 Ill. App.3d 285 (1987)
514 N.E.2d 499
THE PEOPLE OF THE STATE OF ILLINOIS, Plaintiff-Appellee,
v.
LARRY COLLINS, Defendant-Appellant.
No. 4-86-0881.
Illinois Appellate Court  Fourth District.
Opinion filed September 24, 1987.
*286 Daniel D. Yuhas and Patricia G. Mysza, both of State Appellate Defender's Office, of Springfield, for appellant.
Thomas K. Leeper, State's Attorney, of Quincy (Kenneth R. Boyle, Robert J. Biderman, and Rebecca L. White, all of State's Attorneys Appellate Prosecutor's Office, of counsel), for the People.
Affirmed in part, and reversed in part and remanded.
JUSTICE KNECHT delivered the opinion of the court:
Defendant, Larry Collins, pleaded guilty to possession of cannabis and solicitation (bribery) in Adams County circuit court case No. 82-CF-267 in consolidation with Sangamon County circuit court case No. 84-CF-150. He was placed on two years' probation. He subsequently pleaded guilty to three counts of unlawful delivery of cannabis in Adams County circuit court case No. 85-CF-174. He was sentenced to a seven-year extended term because of his prior convictions. Defendant filed two pro se petitions for post-conviction relief pursuant to section 122-1 of the Code of Criminal Procedure of 1963 (Code) (Ill. Rev. Stat. 1985, ch. 38, par. 122-1 et seq.). His attorney also filed such a petition in case No. 82-CF-267. All three petitions were dismissed without any evidentiary hearing. Defendant appeals contending he was deprived of effective assistance of counsel in the case of the post-conviction petition in case No. 82-CF-267 and denied his right to appointment of counsel under section 122-4 of the Code for the petitions filed in case No. 85-CF-174. We affirm the dismissal of *287 the petition in case No. 82-CF-267 but reverse the dismissal in case No. 85-CF-174 and remand for further consideration of the petition by the trial court.
On November 23, 1982, defendant was charged by information in Adams County case No. 82-CF-267 with two counts of possession and delivery of more than 500 grams of cannabis. On April 11, 1984, defendant was charged by indictment in Sangamon County with solicitation (bribery) in case No. 84-CF-150. The Sangamon County case was transferred to Adams County and the two cases were consolidated. On April 12, 1984, defendant pleaded guilty to possession of cannabis and solicitation (bribery) and the delivery of cannabis charge was dismissed by the State. On May 31, 1984, defendant was placed on probation for two years.
On July 30, 1985, defendant was charged by indictment in case No. 85-CF-174 with three counts of unlawful delivery of cannabis, one count of unlawful delivery of a controlled substance and one count of calculated criminal cannabis conspiracy. On November 22, 1985, defendant pleaded guilty to three counts of unlawful delivery of cannabis and the State dismissed the remaining charges. On January 9, 1986, defendant was sentenced to an extended term of seven years in the Department of Corrections after the court found him eligible for an extended term because of his felony convictions in 1984.
Defendant filed his first pro se petition for post-conviction relief in case No. 85-CF-174 on August 18, 1986. He alleged a denial of his constitutional rights, claimed his indigency, and requested counsel be appointed for him. Trial counsel for defendant then filed on October 23, 1986, a petition for post-conviction relief on behalf of defendant in case No. 82-CF-267. That petition alleged improper service of the search warrant immediately preceding defendant's arrest and that defendant's current incarceration was a direct result of the conviction in the 1982 case.
The State filed a motion to dismiss both petitions. Defendant filed another pro se petition for post-conviction relief in case No. 85-CF-174 on November 24, 1986. In it he presented statistical information that he had been the only defendant in Adams County and the State of Illinois during 1984-85 to receive an extended-term sentence for delivery of cannabis and alleged that his constitutional rights were violated under such circumstances.
A hearing on the motion to dismiss all three petitions was held on December 16, 1986, with defendant and trial counsel both present. Trial counsel argued for the petition in case No. 82-CF-267. The court dismissed the petition finding defendant had waived any errors *288 preceding the entry of his guilty plea. The court then heard testimony from defendant and found him to be an indigent person for purposes of an appeal from the dismissal of the petition.
The court asked trial counsel if he wished to respond to the State's motion to dismiss the pro se petitions. Counsel responded he was not familiar with the issues raised other than as stated on the face of the petitions and, therefore, was not in a position to argue the motion although he did present some argument and cases in support of the second motion filed. At no time did the trial court ask defendant if he wished to be heard nor did the trial court appoint trial counsel or any other attorney to represent defendant on his petitions. The court then dismissed the two pro se petitions.
 1 The probation period which defendant was ordered to serve in case No. 82-CF-267 had ended prior to the filing of the post-conviction petition. Section 122-1 of the Code specifically provides that post-conviction relief is available to persons "imprisoned in the penitentiary." (Ill. Rev. Stat. 1985, ch. 38, par. 122-1.) While this provision has been interpreted as applying not only to those imprisoned but to those who are deprived of liberty in some meaningful way (People v. Martin-Trigona (1986), 111 Ill.2d 295, 299-300, 489 N.E.2d 1356, 1358), it has not been applied to those whose sentence is completed at the time they file their post-conviction petition and historically post-conviction relief was not available in such circumstances. (See People v. Dale (1950), 406 Ill. 238, 246-47, 92 N.E.2d 761, 766.) Defendant argues the effect of his conviction in case No. 82-CF-267 was to increase the sentence he received in case No. 85-CF-174, for which he is still incarcerated. Later sentence enhancement is not a meaningful deprivation of liberty entitling defendant to the avenue of post-conviction relief provided in section 122-1 of the Code. The petition filed in case No. 82-CF-267 was properly dismissed.
 2 There is no such problem with the petitions filed in case No. 85-CF-174, however. Defendant is serving a seven-year sentence for that conviction and clearly qualifies to file a post-conviction petition under section 122-1 of the Code. The various sections of the Code dealing with post-conviction petitions detail specific procedures which a trial court must follow when ruling on a post-conviction petition. They were not followed here. Within 30 days after a pro se petition is filed the court must examine the petition and if it determines that the petition is frivolous or patently without merit it must dismiss the petition. (Ill. Rev. Stat. 1985, ch. 38, par. 122-2.1(a).) If the petition is not dismissed it is docketed for further consideration. (Ill. Rev. Stat. 1985, ch. 38, par. 122-2.1(b).) After the petition is docketed, the *289 Code provides:
"If the petitioner is without counsel and alleges that he is without means to procure counsel, he shall state whether or not he wishes counsel to be appointed to represent him. If appointment of counsel is so requested, and the petition is not dismissed pursuant to Section 122-2.1, the court shall appoint counsel if satisfied that the petitioner has no means to procure counsel." Ill. Rev. Stat. 1985, ch. 38, par. 122-4.
 3, 4 The appointment of counsel by the trial court is mandatory if a petition is not dismissed as frivolous or patently without merit and if the defendant is indigent and desires counsel. (People v. Baugh (1985), 132 Ill. App.3d 713, 715, 477 N.E.2d 724, 725; People v. Ward (1984), 124 Ill. App.3d 974, 976, 464 N.E.2d 1144, 1146.) The failure of the court to so appoint counsel constitutes reversible error. 124 Ill. App.3d 974, 976, 464 N.E.2d 1144, 1146.
 5 The trial court in this case was obligated to either dismiss the petitions at the outset or set them for hearing and appoint counsel as defendant requested if defendant was actually found by the trial court to be indigent. The limited assistance rendered by defendant's trial counsel at the hearing on the motion to dismiss was not representation by counsel. The trial court elected to hear arguments on the merits of at least the second petition. It did not dismiss the petitions as frivolous or patently without merit and was, therefore, required to appoint counsel to represent defendant. The failure to appoint counsel was reversible error. We reverse and remand the petition for post-conviction relief in case No. 85-CF-174 for consideration by the trial court pursuant to the provisions of section 122-2.1 of the Code of Criminal Procedure of 1963. Ill. Rev. Stat. 1985, ch. 38, par. 122-2.1.
The dismissal of the petition for post-conviction relief filed in case No. 82-CF-267 is affirmed, and the dismissal of the petitions for post-conviction relief filed in case No. 85-CF-174 is reversed and the petitions are remanded for further consideration by the trial court consistent with this opinion.
Affirmed in part, reversed in part and remanded.
GREEN and LUND, JJ., concur.
