A former Royal Navy vessel, with 73 people on board, almost ran aground off the Tyneside coast after suffering engine failure during sea trials.
The former HMS Dumbarton Castle, now named Bijo, is one of two former patrol vessels which have been refitted for the Bangladeshi Navy.
A lifeboat was launched to assist the 265ft (81m) vessel, which had begun to drift close to rocks at South Shields.
A RNLI spokesman said the ship was about 80ft (24m) from hitting a pier.
No-one was hurt. Two tugs managed to secure lines to the ship and are leading it back to the River Tyne.
The RNLI spokesman said: "It looks like she suffered engine failure while she was out on sea trials.
"It was a close call as she came about 80ft from going into a pier at South Shields in strong winds.
"The Tynemouth lifeboat got to her and managed to stabilise her until she got her anchor down and the tugs arrived."
The Dumbarton Castle and its sister vessel the Leeds Castle have been refitted at A&P Tyne as part of a multimillion-pound deal with the Bangladeshi Navy.
The Castle Class patrol vessels were built in Aberdeen and first entered service with the Royal Navy in 1982, protecting the fishing fleets and oil and gas fields in the North Sea.
They also did long-term service guarding the Falkland Islands after the war, before being sold to the Bangladeshi government.
The project will include the overhaul of the vessels' engines and an upgrade of crew accommodation.