Accumulating evidence indicates that specific strains of mucosa-associated Escherichia coli (E. coli) can influence the development of colorectal carcinoma. This study aimed to investigate the prevalence and characterization of mucosa-associated E. coli obtained from the colorectal cancer (CRC) patients and control group. At two referral university-affiliated hospitals in northwest Iran, 100 patients, 50 with CRC and 50 without, were studied over the course of a year. Fresh biopsy specimens were used to identify mucosa-associated E. coli isolates after dithiothreitol mucolysis. To classify the E. coli strains, ten colonies per sample were typed using enterobacterial repetitive intergenic consensus-based PCR (ERIC-PCR). The strains were classified into phylogroups using the quadruplex PCR method. The PCR method was used to examine for the presence of cyclomodulin, bfp, stx1, stx2, and eae-encoding genes. The strains were tested for biofilm formation using the microtiter plate assay. CRC patients had more mucosa-associated E. coli than the control group (
p
<
0.05
). Enteropathogenic Escherichia coli (EPEC) was also found in 23% of CRC strains and 7.1% of control strains (
p
<
0.05
). Phylogroup A was predominant in control group specimens, while E. coli isolates from CRC patients belonged most frequently to phylogroups D and B2. Furthermore, the frequency of cyclomodulin-encoding genes in the CRC patients was significantly higher than the control group. Around 36.9% of E. coli strains from CRC samples were able to form biofilms, compared to 16.6% E. coli strains from the control group (
p
<
0.05
). Noticeably, cyclomodulin-positive strains were more likely to form biofilm in comparison to cyclomodulin-negative strains (
p
<
0.05
). In conclusion, mucosa-associated E. coli especially cyclomodulin-positive isolates from B2 and D phylogroups possessing biofilm-producing capacity colonize the gut mucosa of CRC patients.