FLINT, Mich. — Senator Bernie Sanders, anxious that the Democratic nomination is slipping away from him, launched a series of cutting and sarcastic attacks against Hillary Clinton over trade, welfare reform and Wall Street in a debate Sunday night that often felt like a war over Bill Clinton’s legacy and the moderate Democratic policies of the 1990s.

Even Mrs. Clinton joined in the repudiation of her husband’s 1994 crime bill and 1996 welfare law, which both disproportionately harmed African-Americans. Both she and Mr. Sanders are aggressively courting black voters in Michigan, Ohio and other racially diverse states that hold primaries over the next nine days, but Mr. Sanders has an urgent need to cut into Mrs. Clinton’s support among African-Americans.

Mr. Sanders, who has fallen far behind Mrs. Clinton in their all-important race to accumulate delegates to clinch the party’s nomination, has rarely been so aggressive. He portrayed Mrs. Clinton as an unapologetic champion of free trade for much of her career, in hopes of hurting her with Rust Belt Democrats. He tied her aggressively to the North American Free Trade Agreement, Mr. Clinton’s signature trade policy, and to the Trans-Pacific Partnership, President Obama’s 12-nation trade pact, which she supported as secretary of state but then denounced as a presidential candidate.

Mr. Sanders also attacked Mrs. Clinton’s support of the federal Export-Import Bank, the credit agency that antigovernment populists on both sides have called an instrument of “corporate welfare,” and he feigned amazement when she expressed criticism of some trade deals.