Polish rescue vessels were scrambled after a multipurpose cargo ship was seen heading straight towards a beach near Gdansk on Saturday morning.
A last-minute turn by the 7,750-dwt Ruslana (built 2007) avoided a grounding, but the master and two officers were later found to be over the limit for alcohol.
The PAP news agency said the Kashubian Border Guard Squadron was forced to intervene when the MPP did not respond to radio calls from vessel traffic authorities and the Gdansk harbour master.
The ship was observed travelling outside the fairway, straight towards Sobieszewo Island at 11 knots, following a sharp turn of more than 180 degrees that took it to within 1km of the shore.
'Unnatural behaviour'
A spokeswoman for Poland's Maritime Office, Magdalena Kierzkowska, told PAP: "We notified the border guard about the unnatural behaviour of the unit."
A border guard boat was sent to the vessel in emergency mode and officers boarded to carry out alcohol tests.
The master and two officers were found to be over the permitted limit.
The Izvestia newspaper cited owner Transflot of St Petersburg as saying the use of alcohol on board was not acceptable.
The company said the crew would be replaced.
The ship was moved to anchorage at Gdansk and later detained by port state officials.
The Ruslana had been sailing from Klaipeda in Lithuania.
The MPP has insurance through the West of England Shipowners Club.
There are no port state control detentions on the vessel's record since 2012, according to the Equasis database.