HONG KONG — Hong Kong’s legislature voted on Wednesday to ban all ivory sales by 2021, closing what activists called a major loophole in the global effort to end the trade and protect elephants from poaching.

The ivory trade has been banned in most of the world since 1990 under the Convention on International Trade in Endangered Species of Wild Fauna and Flora, or Cites, which Hong Kong and all but a handful of countries have agreed to honor. But the sale of antique ivory acquired before the 1970s had remained legal here. Elephant tusks and ivory statues, carvings and chopsticks are still sold in Hong Kong’s antique stores.

City officials originally said that allowing the sale of antique ivory would give local traders time to liquidate their stocks and find a new line of work.