A San Francisco-based ferry company and its affiliate paid the city $2.7 million to settle violations of health care laws for illegally denying health insurance and benefits to hundreds of employees over four years, officials said this week.

The San Francisco Office of Labor Standards Enforcement found that Hornblower Yachts and Alcatraz Cruises created “complex policies” as a way of denying health benefits to 421 employees who qualified for them under the Health Care Accountability Ordinance and the Health Care Security Ordinance, according to the San Francisco City Attorney’s Office.

Officials learned both companies inappropriately denied benefits for seasonal employees who worked 20 hours or more a week and failed to offer employees working 20 hours or more a week a health plan at no premium charge.

The city also found that some employees felt pressured to purchase their own health insurance, asked their parents to help split the cost of insurance, and became “chronically ill” because they couldn’t afford prescriptions or antibiotics for treatment. As a result, city attorney’s officials said workers relied on the city-run San Francisco General Hospital’s emergency room for treatment.

The companies paid the $2.7 million settlement on Sept. 28. The 421 employees got $926,167; $1.3 million went to San Francisco General Hospital to cover costs; and $500,000 went to the city for penalties. The settlement was reached without the city filing a lawsuit against the company, officials said Tuesday.

“What Hornblower and Alcatraz Cruises did cheated not only their employees but also San Francisco taxpayers and the honest competitors in the marketplace,” said San Francisco City Attorney Dennis Herrera. “Let this send a clear message to employers looking to skirt the law: Don’t.”

According to a statement from Hornblower, officials with Hornblower and Alcatraz never admitted wrongdoing, and the San Francisco Office of Labor Standards Enforcement never “issued a final determination of wrongdoing by either company.”

Hornblower officials said they will “continue their efforts to comply with all applicable laws to support the dedicated crews and their families.”

Both companies failed to comply with the Health Care Accountability Ordinance from Jan. 1, 2011, until Sept. 30, 2015, and failed to comply with the Health Care Security Ordinance from July 1, 2012, to June 30, 2015, according to the city attorney’s office.

San Francisco’s Health Care Security Ordinance requires employers to make health care expenditures “on behalf of all covered employees,” officials said. The Health Care Accountability Ordinance requires city contractors and tenants to offer health plan benefits to their covered employees. This ordinance applies to both companies, as they are tenants of the Port of San Francisco, officials said.

Alcatraz Cruises previously violated San Francisco’s health care requirements from April 1, 2010, until March 31, 2013, when the company failed to make $183,459 in health care expenditures for 107 workers, according to the city attorney’s office. Alcatraz Cruises later paid for the expenditures after a 2013 audit revealed the company violated health care requirements.

Lauren Hernandez is a San Francisco Chronicle staff writer. Email: lauren.hernandez@sfchronicle.com Twitter: @LaurenPorFavor