A semiconductor device includes a semiconductor substrate formed of at
least two kinds of group III elements and nitrogen, an active layer
formed on the semiconductor substrate, and a nitride semiconductor layer
formed on a surface of the semiconductor substrate and formed between the
semiconductor substrate and the active layer. The nitride semiconductor
layer is formed of the same constituent elements of the semiconductor
substrate. A composition ratio of the lightest element among the group
III elements of the nitride semiconductor layer is higher than a
composition ratio of the corresponding element of the semiconductor
substrate.