Sailors aboard a Canadian warship helped thwart an attack by Libyan forces in the port of Misrata, according to NATO, firing back after coming under fire.

Several fast small boats were attempting to attack Misrata around 2 a.m. local time, but were pushed back by the frigate HMCS Charlottetown, working with the British destroyer HMS Liverpool and a French warship.

"The boats were forced to abandon their attack and regime forces ashore covered their retreat with artillery and anti-aircraft cannon fire directed towards the allied warships," NATO said in a statement.

HMCS Charlottetown shot back with a short burst of machine-gun fire and HMS Liverpool also returned fire, NATO said. Neither warship sustained any damage.

"It is most likely [the Canadians] would have fired the ship's main gun — a Bofors 57-mm cannon off the front of the ship," CBC's David Common said.

The attack was the second action by pro-Gadhafi forces at sea, according to NATO.