(CNN) A US federal judge threatened to keep ships from Carnival's cruise lines out of American ports as punishment for the company's possible violations of the terms of its probation.

Carnival has been on probation as part of a 2017 settlement in which it agreed to pay $40 million for discarding oil illegally in the ocean from Princess Cruises ships and not telling the truth about it to US authorities. Princess Cruises is owned by Carnival.

On Wednesday, US District Judge Patricia Seitz said she'll decide in a hearing in June what action, if any, to take against the cruise line.

Carnival started its five-year probation period in 2017 and agreed to inspections by third party auditors.

According to court filings, reported by the Miami Herald , the cruise line "sought to avoid unfavorable findings by preparing ships in advance of court-ordered audits, falsified records, dumped plastic garbage into the ocean and illegally discharged gray water into Glacier Bay National Park in Alaska."

Read More