Water is an essential requirement for agricultural productivity. In the agriculture sector, electricity generated by conventional sources contributes to a substantial amount of carbon footprints for pumping water through tube wells. Over the past few decades, a transitional shift towards renewable resources has increased leading to decarbonizing the environment and is considered as a viable solution for electricity production. To assist and provide a road map for this paradigm shift, the proposed study presents a techno-economic and environmental analysis of irrigation systems by carrying comparative analysis of both standalone and grid-connected systems based on four independent sites in a developing country. PV system integrated with grid enabling both energy purchase and sale (PV + G(P+S)), proved to be the most optimal configuration with cost of energy (COE) of $0.056/kWh, $0.059/kWh, $0.061/kWh, and $0.068/kWh while having net present cost (NPC) of $7,908, $20,186, $25,826, and $34,487 for Peshawar, Khyber Agency, Mardan, and Charsadda respectively, over a useful life span of 25 years. Furthermore, sensitivity analysis has been carried out based on uncertain variables such as Grid power purchase (GPP) and average solar radiation (GHI) to check the optimality behavior of the system. Results from environmental analysis revealed that (PV+ G(P+S)) system has a relatively low carbon impact as compared with conventional sources. This configuration also has the ability to prevent excess water extraction by selling any excessive solar PV energy to the grid. This study provides a policy framework insight for the entities for future optimization.