The maximum number of edges spanned by a subset of given diameter in a Hamming space with alphabet size at least three is determined. The binary case was solved earlier by Ahlswede and Khachatrian [A diametric theorem for edges, J. Combin. Theory Ser. A 92(1) (2000) 1