We have carried out first-principles total energy calculations to investigate electronic and elastic properties of both zinc-blende and wurtzite BN, AlN, and GaN. We have calculated lattice parameters, elastic constants, deformation potential constants, phonon frequencies at r point, Born effective charges, and piezoelectric constants. Lattice parameters are fully relaxed by using the first-principles molecular dynamics method with variable cell shape. The internal strain in a strained crystal is also relaxed by the first-principles molecular dynamics method. The internal strain influences the elastic constants, the deformation potential constants, and the piezoelectric constants effectively. We have calculated the wurtzite deformation potential constants D1 – D5 considering the internal strain correction. The piezoelectric constants of wurtzite and also zinc-blende crystals have been calculated using the Berry phase approach and we have found from first principles that those of BN have an inverse sign in contrast to AlN and GaN. Discussions will be given in comparison with results obtained herein with the previous ones. © 1998 American Institute of Physics. [S0021-8979(98)07921-3]