SEOUL, South Korea — A court on Thursday ordered the South Korean government and a shipping company to pay compensation to families who lost relatives in the 2014 sinking of an overloaded, poorly inspected ferry that killed 304 people, most of them high school students.

The ruling by the Seoul Central District Court on Thursday was the first time that the state was held financially culpable in the case. The sinking of the Sewol ferry, South Korea’s worst catastrophe in decades, rattled the nation and helped precipitate the impeachment and ouster of former President Park Geun-hye last year.

The government has already apologized for failing to prevent the sinking of the ferry and botching the rescue operation, offering a compensation package for bereaved families that averaged 470 million won, or about $415,000, per victim. But the families of 118 victims have rejected that offer, and in 2015, they sued the government and Chonghaejin Marine Company, the ferry’s operator, seeking court-ordered compensation.

In its ruling on Thursday, a three-judge panel ordered that the government and the shipping company pay the families compensation averaging 600 million won, or about $530,000, per victim.