Garrett betrayed Billy the Kid, in return he "was made sheriff of Lincoln county".

On November 2, 1880, Garrett was elected sheriff of Lincoln County, New Mexico, having defeated the incumbent, Sheriff George Kimball, by a vote of 320 to 179.

Although Garrett's term would not begin until January 1, 1881, he was eager to capture the fugitive William Bonney (better known as "Billy the Kid"), and persuaded Sheriff Kimball to appoint him a deputy sheriff for the remainder of Kimball's term.
Garrett was further aided when he obtained a deputy U.S. Marshal's commission, which allowed him to pursue the Kid across county lines.

Garrett and his posse stormed the Dedrick ranch at Bosque Grande on November 30, 1880.
They expected to find the Kid there, but only succeeded in capturing John Joshua Webb, who had been charged with murder, along with an accused horse thief named George Davis.

Garrett turned Webb and Davis over to the sheriff of San Miguel County a few days later, and moved on to the settlement of Puerto de Luna.
There a local tough named Mariano Leiva picked a fight with Garrett and was shot in the shoulder.

On December 19, 1880, Billy the Kid, Charlie Bowdre, Tom Pickett, Billy Wilson and Tom O'Folliard rode into Fort Sumner.
Lying in wait were deputy Garrett and his posse.
Mistaking O'Folliard for the Kid, Garrett's men opened fire and killed O'Folliard; 
The Kid (Bonney) and the others escaped unharmed.
Three days later, Garrett's posse cornered the Kid and his companions at a spot called Stinking Springs.
They killed one man and captured the others, including the Kid.

On April 15, 1881, Billy the Kid was sentenced to hang by Judge Warren Bristol, but he escaped thirteen days later.

On July 14, 1881, Garrett visited Fort Sumner to question a friend of the Kid's about his whereabouts and learned he was staying with a mutual friend, Pedro Menard "Pete" Maxwell.
Around midnight, Garrett went to Maxwell's house.
The Kid was asleep in another part of the house, but woke up in the middle of the night and entered Maxwell's bedroom, where Garrett was standing in the shadows.
The Kid did not recognize the man standing in the dark.
He asked him, repeatedly, "¿Quién es?" ("
Who is it?"),
and Garrett replied by shooting at him twice.
The first shot hit the Kid in the chest just above the heart, while the second missed.
Garrett’s account leaves it unclear whether Billy was killed instantly or took some time to die.
Garrett betrayed Billy the Kid, in return he "was made sheriff of Lincoln county".
On November 2, 1880, Garrett was elected sheriff of Lincoln County, New Mexico, having defeated the incumbent, Sheriff George Kimball, by a vote of 320 to 179. 
Although Garrett's term would not begin until January 1, 1881, he was eager to capture the fugitive William Bonney (better known as "Billy the Kid"), and persuaded Sheriff Kimball to appoint him a deputy sheriff for the remainder of Kimball's term. Garrett was further aided when he obtained a deputy U.S. Marshal's commission, which allowed him to pursue the Kid across county lines. 
Garrett and his posse stormed the Dedrick ranch at Bosque Grande on November 30, 1880. They expected to find the Kid there, but only succeeded in capturing John Joshua Webb, who had been charged with murder, along with an accused horse thief named George Davis. 
Garrett turned Webb and Davis over to the sheriff of San Miguel County a few days later, and moved on to the settlement of Puerto de Luna. There a local tough named Mariano Leiva picked a fight with Garrett and was shot in the shoulder.
On December 19, 1880, Billy the Kid, Charlie Bowdre, Tom Pickett, Billy Wilson and Tom O'Folliard rode into Fort Sumner. Lying in wait were deputy Garrett and his posse. Mistaking O'Folliard for the Kid, Garrett's men opened fire and killed O'Folliard; 
The Kid (Bonney) and the others escaped unharmed. Three days later, Garrett's posse cornered the Kid and his companions at a spot called Stinking Springs. They killed one man and captured the others, including the Kid. 
On April 15, 1881, Billy the Kid was sentenced to hang by Judge Warren Bristol, but he escaped thirteen days later.
On July 14, 1881, Garrett visited Fort Sumner to question a friend of the Kid's about his whereabouts and learned he was staying with a mutual friend, Pedro Menard "Pete" Maxwell. Around midnight, Garrett went to Maxwell's house. The Kid was asleep in another part of the house, but woke up in the middle of the night and entered Maxwell's bedroom, where Garrett was standing in the shadows. The Kid did not recognize the man standing in the dark. He asked him, repeatedly, "¿Quién es?" ("Who is it?"), and Garrett replied by shooting at him twice. The first shot hit the Kid in the chest just above the heart, while the second missed. Garrett’s account leaves it unclear whether Billy was killed instantly or took some time to die.
Pat Garrett