Image copyright James Jamieson Image caption Temperatures were high across Scotland on Thursday night

Scotland has recorded its hottest night ever, after temperatures fell to only 20.9C (69.62F) in Achnagart, north-west Scotland.

After Edinburgh registered the hottest day of 2019 at 31.6C (88.9F) - the city's hottest day ever - the heat continued overnight on Thursday.

The previous record for the warmest night was 20.5C (68.9F).

Parts of Scotland saw thunderstorms after a yellow weather warning was issued.

Image caption Edinburgh registered the hottest day of 2019 with a temperature of 32C

Friday was expected to be cooler than Thursday, with temperatures ranging from 23C to 25C in most areas (73F to 77F), rising to 27C in south-east England.

Along Scotland's Moray Firth coastline the temperatures were expected to range from 25C-27C (77F-80.6F).

The hottest UK July day on record was confirmed on Thursday with temperatures reaching 37.7C (98.6F) in Essex and west London.

The previous record for July was 36.7C (98F.

You must enable JavaScript to view this content. Compare the temperature where you are with more than 50 cities around the world, including some of the hottest and coldest inhabited places. Enter your location or postcode in the search box to see your result. Find a location Your location °C °C °C

This temperature comparison tool uses three-hourly forecast figures. For more detailed hourly UK forecasts go to BBC Weather.

If you can't see the calculator, tap here

Edinburgh's previous record temperature was 31.4C (88.5F) recorded in 1975.

BBC Scotland weather presenter Kirsteen Macdonald said: "The July record for Scotland is 32.8C (91.04F) which was recorded in Dumfries, way back in 1901 and 1908 respectively."

Image caption Children in Glasgow enjoyed the Riverside Museum sand pit

Current record temperatures across the UK are:

Scotland: 32.9C (91.2F) in Greycrook, Borders on 9 August 2003

England and UK: 38.5C (101.3F) in Faversham, Kent on 10 August 2003

Wales: 35.2C (95.4F) in Harwarden Bridge, Flintshire on 2 August 1990

Northern Ireland: 30.8C (87.4F) in Knockarevan, County Fermanagh on 20 June 1976 and Shaw's Bridge, Belfast on 12 July 1983

Image caption The scene in Shetland was idyllic

A Met Office yellow warning was in place from 15:00 on Thursday into early Friday morning for thunderstorms and possible travel delays, flash flooding, and power cuts.

Is the heatwave caused by climate change?

While extreme weather events like heatwaves occur naturally, "research shows that with climate change they are likely to become more common, perhaps occurring as regularly as every other year", the Met Office says.

It conducted a study last year that found that the UK was now 30 times more likely to experience heatwaves compared with the year 1750, because of "the higher concentration of carbon dioxide (a greenhouse gas) in the atmosphere".

Records going back to the late 19th Century show that the average temperature of the Earth's surface has increased by about one degree since industrialisation.

A climatology institute in Potsdam, Germany, says Europe's five hottest summers since 1500 have all been in the 21st Century.

Scientists are concerned that rapid warming linked to use of fossil fuels has serious implications for the stability of the planet's climate.

Media playback is unsupported on your device Media caption Why is it so hot and is climate change to blame?

Meanwhile the dangers of cooling off in lakes, rivers and the sea were highlighted after six youths were rescued from the River Dee in Aberdeenshire after getting into difficulty.

Scottish Fire and Rescue Service teams from Aberdeen and Dundee were called out to Potarch Bridge just after 20:30 on Wednesday after water levels rose, leaving the youths unable to get back to shore.

The teams used an inflatable rescue sled to bring them to safety by about 22:15.

Network Rail Scotland urged passengers to stay hydrated while travelling on trains, reminding them that there are free drinking fountains at Waverley and Glasgow Central Stations.

And passengers travelling by train to Glasgow and Edinburgh from London faced delays, which were attributed to heat-related incidents in the south of England.

London North Eastern Railway, which operates the East Coast Main Line franchise, advised customers against travel for the rest of the day as record high temperatures caused "several incidents" on the East Coast route.

Image caption Glaswegians took to the parks to enjoy the sunshine

This included problems with infrastructure in the Peterborough area which led to LNER services in and out of London King's Cross being cancelled.

The Rail Delivery Group, which represents train operators and Network Rail, warned problems on the railways could continue until the weekend.

The Scottish SPCA also tweeted warnings asking people to reconsider leaving their dog in the car while they are out and about.