The UK's credit rating outlook has been downgraded to "negative" from "stable" by ratings agency Moody's.

The firm changed its outlook following the UK's vote to leave the European Union in Thursday's historic referendum.

In an update released on Friday, Moody's said the result would "herald a prolonged period of uncertainty for the UK, with negative implications for the country's medium-term growth outlook."

Negotiations with the EU over new trade deals would take "several years", it said, during which there would be "heightened uncertainty, diminished confidence and lower spending and investment to result in weaker growth."

However, the firm reaffirmed its sovereign rating of the UK at Aa1, saying "Moody's believes that a scenario in which the UK manages to preserve many (albeit not all) of its current trade benefits from EU membership is plausible."

The update continued: "The UK government has one of the largest budget deficits among advanced economies, and lower GDP growth will further complicate the implementation of the government's multi-year fiscal consolidation plan.

"Consequently, the public debt ratio will likely remain higher than the rating agency previously expected."

Moody's said the UK's credit rating could be downgraded if it could not negotiate access to the EU's single market or fail to reduce the budget deficit.

The early hours of Friday saw the stock market plummet as the result of the referendum was confirmed.

Sterling fell to a three-decade low and the FTSE 100 index also plunged before beginning to crawl back later in the day.