Caffeine won't give you a mental boost if you did not get enough sleep for three nights in a row, a new study suggested.

"These results are important because caffeine is a stimulant widely used to counteract performance decline following periods of restricted sleep," Tracy Jill Doty, research scientist at Walter Reed Army Institute of Research and lead author of the study, said in a news release.

"The data from this study suggests that the same effective daily dose of caffeine is not sufficient to prevent performance decline over multiple days of restricted sleep," Doty added.

The study, which was presented during a meeting of the Associated Professional Sleep Societies in Denver, analyzed 48 participants who only slept for 5 hours for five nights. The participants took either an inactive placebo or 200 milligrams of caffeine - which is equivalent to a big cup of coffee - twice a day.

The participants were also tested relative to their moods, sleepiness, wakefulness and reaction times. Mental skill tests were also given to the participants.

For the first few days, the caffeine-drinkers scored better in the tests than those who took placebo. The caffeine group also reportedly felt happier than the placebo group on the first few days of the experiment.

But after three nights, the participants' alertness and their performance on a series of mental tests dropped even after having caffeine, the researchers found. The caffeine group also rated themselves more annoyed than those in the placebo group.

According to Doty, this is the first time a study of this kind was conducted. There is little research about how caffeine affects people who chronically get too little sleep, she said.

"This is particularly important information for the military, where war fighters may have restricted sleep and may also be using caffeine," Doty told Live Science.

However, the study did not consider the fact that sleep-deprived people might increase their caffeine intake over time.

"Increased caffeine dosage will increase negative side effects such as jitteriness, but we do not currently know if an increased dosage would prevent performance decline," Doty said.