PurposeThis study examines whether customer-perceived employee competence (CPEC) furthers customer loyalty through justice perception and affection, and whether gender and service failure moderate these relationships.Design/methodology/approachData were collected from 535 customers of five Indian rural banks administering the questionnaire. The questionnaire gathered information on sociodemographics and measured constructs using standard inventories. The data were analyzed using structural equation modeling.FindingsThe results reveal that when the effects of age are controlled for, CPEC enhances attitudinal and behavioral loyalty. The effects of CPEC partially influence attitudinal and behavioral loyalty through justice perception and customer affection. Attitudinal loyalty also promotes behavioral loyalty. With a few exceptions, stronger (weaker) effects are observed for female (male) gender and low (high) service failure, including CPEC influencing loyalty and justice perception, justice perception impacting customer loyalty and affection, customer affection promoting loyalty and attitudinal loyalty furthering behavioral loyalty.Originality/valueCustomers need competent employees to address bank service failure. CPEC fosters justice perception and affection, which in turn increases customer loyalty to the bank.