YAKIMA, Wash. — Twenty-year-old Lameiro Flores was sentenced Monday to 40 years in prison for fatally shooting two teenagers at a Naches River swimming hole last year.

Flores initially claimed self-defense in shooting at three teenagers, but reversed course last week and against his own attorney’s recommendations pleaded guilty to two charges of first-degree murder.

Flores fatally shot Jose G. Avilez, 17, and Jobany Martinez, 18, on Aug. 6, 2012. He said they had assaulted him in the past and he feared another attack. According to police, the two were both shot in the head at close range with a .45-caliber semiautomatic pistol.

The third teenager, Juan Acevedo, escaped without injury.

Flores told police he took the gun with him to a Naches River swimming hole, just west of the Yakima Greenway parking lot on North 16th Avenue, because he had a “gut feeling” he would need it. He opened fire after the teens told him, “Catch you later,” which he took as a threat.

But prosecutors said Flores was never in imminent danger and suggested he went to the river with murder in mind. They said his attire — jeans and a football jersey on a hot summer day — and text messages he sent shortly before the shooting suggested as much.

In his statement before the court Sept. 23, Flores said he did go to the river with the intent to kill the teenagers. In return for his plea, prosecutors agreed to drop deadly weapon sentencing enhancements and an attempted murder charge.

Deputy prosecuting attorney David Soukup said Flores would have 36 months of supervision following his release after the 40-year sentence. Soukup said Flores also has the opportunity to shave off up to 10 percent of the sentence for good behavior.