We present the results of an extensive study of the final stage of terrestrial planet formation in disks with different surface density profiles and for different orbital configurations of Jupiter and Saturn. We carried out simulations in the context of the classical model with disk surface densities proportional to r −0.5 , r −1 and r −1.5 , and also using partially depleted, non-uniform disks as in the recent model of Mars formation by Izidoro et al (2014). The purpose of our study is to determine how the final assembly of planets and their physical properties are affected by the total mass of the disk and its radial profile. Because as a result of the interactions of giant planets with the protoplanetary disk, secular resonances will also play important roles in the orbital assembly and properties of the final terrestrial planets, we will study the effect of these resonances as well. In that respect, we divide this study into two parts. When using a partially depleted disk (Part 1), we are particularly interested in examining the effect of secular resonances on the formation of Mars and orbital stability of terrestrial planets. When using the disk in the classical model (Part 2), our goal is to determine trends that may exist between the disk surface density profile and the final properties of terrestrial planets. In the context of the depleted disk model, results of our study show that in general, the ν 5 resonance does not have a significant effect on the dynamics of planetesimals and planetary embryos, and the final orbits of terrestrial planets. However, ν 6 and ν 16 resonances play important roles in clearing their affecting areas. While these resonances do not alter the orbits of Mars and other terrestrial planets, they strongly deplete the region of the asteroid belt ensuring that no additional mass will be scattered into the accretion zone of Mars so that it can maintain its mass and orbital stability. In the context of the classical model, the effects of these resonances are stronger in disks with less steep surface density profiles. Our results indicate that when considering the classical model (Part 2), the final planetary systems do not seem to show a trend between the disk surface density profile and the mean number of the final planets, their masses, time of formation, and distances to the central star. Some small correlations were observed where, for instance, in disks with steeper surface density profiles, the final planets were drier, or their water contents decreased when Saturn was added to the simulations. However, in general, the final orbital and physical properties of terrestrial planets seem to vary from one system to another and depend on the mass of the disk, the spatial distribution of protoplanetary bodies (i.e., disk surface density profile), and the initial orbital configuration of giant planets. We present results of our simulations and discuss their implications for the formation of Mars and other terrestrial planets, as well as the physical properties of these objects...