Lilly King had but one regret Sunday, after she helped the U.S. women win gold in the 400-meter medley relay at the world championships. As the athlete swimming the second leg of the race, she didn’t get to sit back and watch Regan Smith set another world record.

Smith, of Lakeville, was chosen to lead off the relay and clocked a time of 57.57 seconds on the backstroke leg, claiming the world record in the 100 back in Gwangju, South Korea. By giving the Americans such a rousing start, she helped them lower the world record in the relay as well, with a final time of 3 minutes, 50.40 seconds. Smith, 17, broke the world record in the 200 back on Friday and won gold in that event Saturday.

King (breaststroke), Kelsi Dahlia (butterfly) and Simone Manuel (freestyle) completed the all-star lineup for the Americans, who cut 1.15 seconds off the world record the U.S. had set at the 2017 world championships.

“I was telling [Smith] before I went out, I was mad I’m swimming breaststroke, because I won’t get to see her split,” King said to reporters after the race. “There’s nothing better than diving in a body length ahead already. I’m super proud of her and what she’s been able to accomplish.”

The two golds are Smith’s first medals at the senior world championships. In the 200 back, she broke a record set by Missy Franklin in 2012, finishing her semifinal in 2:03.35.

The relay victory came in the final event of the meet. The U.S. led all nations with 27 medals at the world championships, including 14 golds.

“After what I was able to do in the [200] back, I sure hoped [for another record],” Smith said to reporters in Gwangju. “I was feeling really confident and really excited.

“I had a really good feeling going in. I was super, super happy when I finished.”

Smith did not qualify to swim the individual 100 back at the world championships, but she ranked second in the world in that event entering the meet. Her jaw-dropping performances in the 200 back — including a time of 59.45 on the first 100 meters of the final — earned her a spot on the medley relay.

She bested the previous world record of 58.0 set by American Kathleen Baker in 2018. Smith’s previous best time in the 100 back was 58.45, a world junior record swam last month at the Counsilman Classic in Indiana.

Manuel led the U.S. women with seven medals, the most ever for a woman at a world championship meet. Caeleb Dressel paced the American men with a record eight medals, including six golds.

“To start it off with a world record from Regan, I think that really pumped us all up,” Manuel said. “We definitely wanted to finish the meet on a good note. Props to her, and props to all of us on the relay. We’re really happy with that swim.”

The veterans on the U.S. team all were raving about Smith on Sunday. Her record backstroke leg set the tone for the relay, instantly giving the U.S. a huge lead. She was 1½ seconds faster than Australia’s Minna Atherton, who touched the wall in 59.06 to put the Aussies in second place going into the breaststroke leg.

Australia’s relay team took the silver medal in 3:53.42, more than three seconds behind the Americans. Canada earned bronze.

“I’m just so proud of her,’’ said Dahlia, one of Smith’s roommates at the world championships. “She’s so young, but she already has so much experience, and she carries herself so well. She’s so confident in her own decisions and her training.”

Smith’s relay time was well under the 58.60 that Canada’s Kylie Masse swam to win gold in the individual 100 back. Baker and Olivia Smoliga swam that event for the United States, with Smoliga earning bronze in 58.91. Baker tied for sixth in 59.56.

Smith confirmed after the race that she plans to compete at the U.S. Championships, July 31-Aug. 4 at Stanford University. She will be a senior this fall at Lakeville North and has verbally committed to swim at Stanford.