We present a theoretical study of hydrogenated amorphous silicon nitride (a-SiNx:H), with equal concentrations of Si and N atoms (x=1), for two considerably different densities (2.0 and 3.0 g/cm3). Densities and hydrogen concentration were chosen according to experimental data. Using first-principles molecular-dynamics within density-functional theory the models were generated by cooling from the liquid. Where both models have a short-range order resembling that of crystalline Si3N4 because of their different densities and hydrogen concentrations they show marked differences at longer length scales. The low-density nitride forms a percolating network of voids with the internal surfaces passivated by hydrogen. Although some voids are still present for the high-density nitride, this material has a much denser and uniform space filling. The structure factors reveal some tendency for the nonstoichiometric high-density nitride to phase separate into nitrogen rich and poor areas. For our slowest cooling rate (0.023 K/fs) we obtain models with a modest number of defect states, where the low (high) density nitride favors undercoordinated (overcoordinated) defects. Analysis of the structural defects and electronic density of states shows that there is no direct one-to-one correspondence between the structural defects and states in the gap. There are several structural defects that do not contribute to in-gap states and there are in-gap states that do only have little to no contributions from (atoms in) structural defects. Finally an estimation of the size and cooling rate effects on the amorphous network is reported.