The people of Numidia were semi-nomadic, indistinguishable from the other Berbers in North Africa until the reign of Masinissa, who became a Roman ally in 206 BC, with a kingdom roughly equivalent to modern Algeria. His son Micipsa succeeded him in 148 B.C. Jugurtha, Masinissa's illegitimate grandson, was very popular among the Numidians -- so popular that Micipsa sent him away to Spain, but there Jugurtha made influential Roman contacts.
When Micipsa died in 118, the kingdom of Numidia was ruled by Micipsa's two sons Hiempsal (whom Jugurtha had assassinated) and Adherbal, and Jugurtha. Then, when Jugurtha attacked Adherbal, he fled to Rome for help. Jugurtha, meanwhile, bribed officials in Rome. They divided Numidia into two parts, with Jugurtha assigned the western and richer half.
By 112 Jugurtha was no longer content with his half, so he went east to attack Adherbal. He incurred the wrath of Rome, in the process, by killing Italian businessmen. A well-placed bribe cooled the Roman hot water Jugurtha should have been in: Jugurtha received a treaty instead of a Roman attack. Soon, however, he was summoned to Rome to explain the terms of the suspicious treaty. There, after Jugurtha arranged to have a rival killed, he lost all support.
War broke out between Numidia and Rome. At first Jugurtha fared well because of Roman incompetence, and drove the Romans out, but in 107, the new consul, Gaius Marius, appeared on the scene. With the help of Bocchus I of Mauretania, Marius' quaestor, Lucius Cornelius Sulla, was able to capture Jugurtha.
Jugurtha was executed by the Romans in 104 BC