There was growing optimism on the fringes of the Gleneagles summit that the United States and France had been able to reach a compromise on the thorny issue of climate change.
Jack Straw, the Foreign Secretary, rushed up from London to take over the chairmanship of the meetings after the Prime Minister, Tony Blair, returned to London in the wake of the terrorist attacks.
The final terms of the deal are unlikely to satisfy environmentalists, who want all countries to sign up to binding targets on the carbon emissions that scientists say are causing the world to heat up.
Original plans to produce two separate communiqués - one today on Africa and another yesterday on climate change, global terrorism and the world economy - were scrapped in the wake of yesterday's events.
Amid tightened security, Sir Michael Jay, the Government's chief negotiator, took over the negotiations following the Prime Minister's departure. On climate change, it is understood that a deal was agreed in principle - although it contained no new figures. The wording gives France some of the tough language it wanted. The communiqué is expected to include an explicit reference to the Kyoto treaty, which the US has not signed, and an acceptance on the scientific front that climate change is occurring and induced by man.
Mr Blair said that the intention of the summit had not been "go back over" the terms of the Kyoto treaty. "We're not going to negotiate some new treaty in climate change at the G8 summit. That's not what it's about," he said. "We're not going to resolve every single issue at the G8 summit in relation to this but I think what we can do is narrow the issues down, get agreement that there is a problem, that we need to tackle it, that we need to move forward together in doing so."
Gordon Brown, the Chancellor, revealed this week that the World Bank is expected to play a frontline role in the fight against global warning by offering financial incentives to developing countries to cut their greenhouse emissions and adopt "clean" technologies.
Mr Brown also said that the communiqué would double aid to Africa - a key demand of campaign leaders such as Bono and Bob Geldof - by 2010. The issue of debt relief was largely settled last month from finance ministers from the G7 agreed to write off $40bn (£23bn) of debts held by 18 poor countries to the World Bank and International Monetary Fund.
After hours of negotiations, hopes were mounting of a deal on the issue of trade - the trickiest issue out of the so-called "trinity" of debt, aid and trade.
The communiqué is expected to set a timetable for the elimination of export farm subsidies. This has proved a thorny issue between the UK, which wants abolition by 2010 and the French, who have demanded a delay until 2016.
One source said that the G8 was determined to make a gesture, adding that the US was happy to comply with the demands of other countries in the wake of its resolution of its dispute with the World Trade Organisation over cotton subsidies.
Oil prices featured prominently in discussions yesterday after hitting $62 a barrel this week, despite expectations that the leaders would appeal for more stable prices and more freedom for oil companies to invest in oil-rich countries.
There were no plans to include any comment on currencies in the economic communiqué. G8 leaders were also due to discuss foreign policy issues, particularly the Middle East, although they were not expected to make any major announcements.