WASHINGTON — Carnival Corp’s Princess Cruise Lines will plead guilty to seven felony charges for polluting the seas and deliberate acts to cover it up, and pay a record $40 million criminal penalty, the U.S. Justice Department said on Thursday.

The charges against Carnival’s Santa Clarita, California-based Princess unit stem from “illegal dumping of oil contaminated waste from the Caribbean Princess cruise ship,” the department said in a statement on the company’s “deliberate pollution of the seas and intentional acts to cover it up.”

The ship, which can carry more than 3,100 passengers and 1,200 crew members, has made numerous visits since 2008 to Bar Harbor and Portland, Maine’s top and second-busiest cruise ship ports respectively.

Shares of Carnival, the world’s largest cruise operator, were down more than 2 percent at $50.29 in midday trading on the New York Stock Exchange after the announcement.

The Caribbean Princess had been making illegal discharges since 2005 using bypass equipment — including a so-called “magic pipe” — to circumvent pollution-prevention equipment that separates oil and monitors oil levels in the ship’s water, the department said.

“We are extremely disappointed about the inexcusable actions of our employees who violated our policies and environmental law when they bypassed our bilge water treatment system and discharged untreated bilge water into the ocean,” Princess Cruises said in a statement.

The cruise line also said it has implemented measures to improve oversight and accountability and invested in training and equipment upgrades to ensure compliance with environmental regulations.

U.S. investigators began to probe the ship’s actions after a whistle-blower engineer reported illegal dumping off the coast of England in August 2013. Two other top ship engineers then ordered a cover-up, called on subordinates to lie and sought to remove the pipe.

“This is a company that knew better and should have done better,” Assistant Attorney General John Cruden said in the statement. “Hopefully the outcome of this case has the potential not just to chart a new course for this company but for other companies as well.”

The Caribbean Princess ship visited ports in nine U.S. states and two territories, including Florida, New York, Maine the U.S. Virgin Islands, the department said.

U.S. investigators also found the Caribbean Princess and four other Princess ships engaged in two other illegal practices affecting water discharge, it added.

U.S. Attorney Wifredo Ferrer in Miami called the company’s conduct overall “particularly troubling,” given its “documented history of environmental violations,” including in southern Florida.

Cruise ship travel has generated concern among environmental groups and governments over water contamination and waste as the industry adds passengers, routes and larger ships.

Some environmental groups have criticized the cruise industry for not being more proactive in reducing air and water pollution and for not being transparent about their efforts.

Friends of the Earth’s 2016 report rating cruise ship lines gave Princess Cruises an overall grade of “C” with an “A-” for water quality compliance and an “F” for transparency.

Cruise Line International Association, which represents the industry, has pledged to take steps to reduce cruise travel’s environmental impact and has said cruise lines must follow international standards.

In a prepared statement released Thursday, CruiseMaineUSA, the state’s cruise ship marketing entity, said it and its member ports in Maine were “shocked and disappointed” by the ship’s actions and the company’s guilty plea.

“We find behavior that knowingly violates environmental rules and regulations that are specifically put in place to protect our waters completely unacceptable,” CruiseMaineUSA officials wrote in the release. “We highly encourage increased oversight and rigorous enforcement by the United States Coast Guard when vessels are in all of our Maine ports.”

Reporting by Susan Heavey; Editing by Dan Grebler and Steve Orlofsky

Bangor Daily News writer Bill Trotter contributed to this story