Experts will examine ways to recycle the resources contained in Scotland's sewage through a partnership between Scottish Water and the Scottish Environment Protection Agency (Sepa),
The two organisations have signed a Sustainable Growth Agreement (SGA) focused on finding new ways to recover more resources from the waste Scottish Water manages and generates.
Under the agreement, Sepa and Scottish Water have pledged to develop, trial and then seek to deliver innovative ways of helping "generate wealth not waste" by maximising the recovery of resources from Scotland's sewage and putting them back into a "circular economy".
They have also pledged to manage rainwater and waste water drainage to help protect the social, economic and environmental wellbeing of Scotland's towns and cities in a changing climate.
The third element of the agreement is a pledge to choose ways to invest in protecting the quality of Scotland's water environment that minimise energy and resource use and maximise social and economic benefit now and for the future.
Environment Secretary Roseanna Cunningham MSP announced the agreement at the Institute of Water Shaping the Future' Conference in Glasgow on Thursday.
She said: "I am pleased to welcome this agreement which will see two public bodies work in partnership to tackle the challenges of delivering a cleaner and greener Scotland in the 21st Century.
"It will look for innovative ways to deliver more sustainable wastewater services, and to recover and recycle the resources that are contained within Scotland's sewage."
Ms Cunningham was joined by Scottish Water Chief Executive, Douglas Millican, and Sepa Chief Executive, Terry A'Hearn.
Mr Millican said: "Innovation and being as sustainable as possible to ensure we maximise our resources to benefit customers underpins our activity as an organisation.
"We manage almost a billion litres a day of waste water through our sewage network and in our treatment works.
"We believe there is significant potential to release further economic value from that and will work with SEPA to understand how it can be delivered."
Scottish Water said the partnership will contribute to the Scottish Government's Energy Strategy core objective of decarbonisation of energy by 2050, and will also help towards achieving the carbon emissions reduction target of 80% by 2050 set out by the Scottish Government's Climate Change Plan.
Mr A'Hearn said: "We will support Scottish Water to find and take opportunities to comply with regulatory requirements and to go beyond compliance in ways that enhance the environment, minimise resource use and maximise long-term social and economic benefits."