The De-mat Gun, or dematerialization gun, was a powerful weapon of the Time Lords of the planet Gallifrey. A remark by Borusa implied that Rassilon had at least a hand in its construction or design. It could remove the target from space-time, but required the Great Key of Rassilon to arm it.
When its trigger was pulled, the De-mat gun would fire a beam that erased whatever it hit from reality itself. The gun's power frightened the Time Lords, and they forbid its use in battle under normal circumstances. The De-mat gun was only acceptable to use as a final resort, and even then, require the Great Key of Rassilon to operate, preventing it from being used if it was stolen. However, this decision was revoked when war broke out on Gallifrey, leading the Time Lords to permit its use and mass-produce the mighty weapon.
The weapon's power to erase matter from existence was highly volatile. Not only would it remove its target from existence, but its residual energy was capable of erasing the memories of individuals close to its vicinity, including those who fired the gun. The beam fired from the gun was also never controlled well enough to avoid erasing the gun itself, which meant that the De-mat gun was limited a single shot and a single use before it would be lost forever.
As Lord President, the Fourth Doctor used the De-mat gun against the Sontaran leader Stor and his remaining troops in the Capitol on Gallifrey. The gun apparently vaporised itself, leaving only the Great Key. After this, the Doctor could not remember the last few days. (TV: The Invasion of Time)
The Great Key was lost some time in the Second War in Heaven, necessitating the Time Lords to research further more destructive weapons. (PROSE: Alien Bodies, The Ancestor Cell) De-mat guns were used in the war and stored on Gallifrey Nine. (PROSE: The Taking of Planet 5)
Toward the end of the Last Great Time War, the Eighth Doctor was imprisoned for over a month on an unknown planet with a Malmooth named Chantir. It turned out the Eighth Doctor had planned his imprisonment to infiltrate the prison and steal the Great Key when it arrived on a transport. After escaping with it, the Doctor noted the Great Key had been part of a weapon called the De-mat Gun, which could completely remove something from time and space.
The Doctor intended to modify the gun so that it could remove millions from time and space at once, possibly sealing the Medusa Cascade if needed. (COMIC: The Forgotten) This device may have been what became known as the Moment, and the Doctor used it to end the Time War. (TV: The End of Time, COMIC: Don't Step on the Grass) The Doctor said that he did fire the De-Mat gun he made at some point in the future, but its side-effect of memory erasure caused him to forget nearly all of his encounter with Chantir, among many other things. (COMIC: The Forgotten)