WASHINGTON (AP) — The U.S. trade deficit hit the highest level in nine years in 2017, defying President Donald Trump's efforts to bring more balance to America's trade relationships.

The Commerce Department says the trade gap in goods and services rose to $566 billion last year, highest since $708.7 billion in 2008. Imports set a record $2.9 trillion, swamping exports of $2.3 trillion. The import surge reflects America's economic strength; confident consumers are buying more foreign products.

The goods deficit with China hit a record $375.2 billion in 2017. And the goods gap with Mexico rose to $71.1 billion. Trump has sought to reduce the deficits with China and Mexico.

The overall December trade deficit in goods and services rose to $53.1 billion, highest since October 2008, from November's $50.4 billion.