The objective of the present study was to investigate whether lymphopenia occurring after heart surgery with cardiopulmonary bypass (CPB) is related to apoptosis and or sepsis in children. The design was a prospective cohort study in a third level care hospital in Mexico City. In total, 68 children (31 girls and 37 boys) with congenital cardiopathy who needed corrective cardiac surgery with or without CPB were included. The samples were obtained from central blood before, immediately after and 24 h after surgery. Complete blood counts and lymphocyte apoptosis were analyzed. Systemic inflammatory response syndrome (SIRS), sepsis and the type of microorganism were recorded. A total of 53 patients received CPB and 15 did not. Lymphocyte count decreased after surgery in both groups (P<0.001). However, neutrophil count increased markedly in both groups. Apoptosis of B (CD19 +) lymphocytes was higher in the non-CPB group (14, 2 and 21% before, immediately after and 24 h after surgery, respectively) than the CPB group (0, 2 and 3%, respectively), but apoptosis of cytotoxic T lymphocytes (CD8 +) was higher in the CPB group (5, 4 and 3% before, immediately after and 24 h after surgery, respectively) than in the non-CPB group (2, 3 and 2%, respectively). However, the extent of apoptosis of T and B lymphocytes after surgery did not differ between groups. The CPB group had more complications than the non-CPB group [38 (71.7%) vs. 9 (60.0%)]. In conclusion, the decrease in lymphocyte count may be related to apoptosis of cytotoxic T lymphocytes in children receiving cardiac surgery with CPB and to apoptosis of B lymphocytes in those not receiving CPB. The decreased lymphocyte counts in both groups suggested that CPB is not the main cause of this decrease. Children who received CPB during surgery had more complications, such as sepsis and cardiogenic shock than did those who did not receive CPB.