Undoped LaFeAsO, parent compound of the newly found high-Tc superconductor, exhibits a sharp decrease in the temperature-dependent resistivity at ~160 K. The anomaly can be suppressed by F doping and the superconductivity appears correspondingly, suggesting a close associate of the anomaly with the superconductivity. We examined the crystal structures, magnetic properties and superconductivity of undoped (normal conductor) and 14 at.% F-doped LaFeAsO (Tc = 20 K) by synchrotron X-ray diffraction, DC magnetic measurements, and ab initio calculations to demonstrate that the anomaly is associated with a phase transition from tetragonal (P4/nmm) to orthorhombic (Cmma) phases at ~160 K as well as an antiferromagnetic transition at ~140 K. These transitions can be explained by spin configuration-dependent potential energy surfaces derived from the ab initio calculations. The suppression of the transitions is ascribed to interrelated effects of geometric and electronic structural changes due to doping by F- ions.