Abstract : In this paper, we provide a mathematical framework for the analysis, design, and optimization of network-coded cooperative diversity (NCCD) protocols. The analysis is applicable to relay-aided protocols based on the error propagation model, which rely on appropriately designed diversity-combining demodulators at the destination. Wireless networks with an arbitrary number of sources and relays are considered. Arbitrary multilevel modulation schemes and network codes constructed over a non-binary Galois field (GF) are analyzed. NCCD protocols based on repetition-based and relay selection cooperation are investigated. Two takeaway messages emerge from our analysis: 1) repetition-based NCCD protocols are capable of achieving full-diversity, e.g., if the GF size is sufficiently large and the network code satisfies the maximum distance separable (MDS) property; and 2) NCCD protocols based on relay selection are capable of achieving full-diversity under more restrictive assumptions than repetition-based protocols, e.g., if the number of active relays is no fewer than the number of sources and an MDS network code is used.