Donald Trump signed a security deal with Denmark and Greenland to end a bitter dispute over the Arctic island, saying the U.S. will start building two “very major military bases” on the territory.

Trump sealed the agreement alongside Danish Prime Minister Mette Frederiksen and Greenland’s leader, Jens-Frederik Nielsen, in New York on Tuesday, with the full text of the agreement published right after signing.

The agreement will give the U.S. “permanent control over security and all other needs on that territory,” Trump said earlier on Tuesday at the U.N. General Assembly.