Media playback is unsupported on your device Media caption 'This American carnage stops right here,' Donald Trump said at his inauguration

During his presidential campaign, and since taking office, Donald Trump has repeatedly warned of the dangers facing the United States.

"I have learned a lot in the past two weeks," he told a meeting of police officers in Washington DC on Wednesday.

"Terrorism is a far greater threat than the people of our country understand. I'm going to take care of it."

His comments came as the legal battle continued over his travel ban on people from seven Muslim-majority nations. Not putting the ban in place would mean the US "can never have the security and safety to which we are entitled", he said on Twitter.

On Wednesday, he also lamented inner-city violence, as well as the killing of police officers.

It is a vision of an America full of danger, with multiple threats on many fronts, encapsulated by the new president's inaugural address referencing "American carnage". But is it correct?

Police fatalities

Media playback is unsupported on your device Media caption In July 2016, the BBC's More or Less programme investigated the unreliable numbers around police shootings in the USA.

"The number of officers shot and killed in the line of duty last year increased by 56% from the year before," President Trump said on Wednesday. And the statistic is accurate, unlike some others he has quoted in the past.

The number of officers shot and killed in the line of duty did indeed jump 56%, from 41 in 2015 to 64 last year - that's according to the National Law Enforcement Officers Memorial Fund.

It is a stark statistic. Starker still is the fact that 21 of those officers were killed in ambush-style shootings, a 163% increase on the previous year.

However, it would be incorrect to read from this that a wave of police shootings has swept the country. Eight of those killings were in two assaults in 10 days in July 2016, in Dallas, Texas and Baton Rouge, Louisiana, and occurred in the context of protests against police killings of African-Americans.

"Last year in Dallas, police officers were targeted for execution - think of this, whoever heard of this?" President Trump told the meeting of police officers.

But the targeting of police officers is not in itself a new phenomenon - it is only that 2016 had higher numbers than before. And statistics show that officers are still more likely to be shot dead responding to a domestic disturbance than any other incident.

In fact, if you look at the bigger picture, police deaths on duty have been dropping for some time.

The worst year for police deaths was 1930, when 307 died. More recently, there was a peak of 241 in 2001, largely due to the 11 September attacks.

But between 2011 and 2013, there was an almost 40% drop in police fatalities - from 177 to 109. The numbers have crept up again in the years since - up 10% in 2016 to 135 - but there is an overall pattern of decline, with the numbers now down to the levels of the 1950s.

Having said that, the likelihood of a police officer being shot dead is far higher than that of a member of the public being killed by the police.

US police shootings in 2016 64 police officers shot dead 963 people shot dead by police 0.007% of police officers shot dead

0.00003% of general population shot dead by police

0.0005% of black population shot dead by police AP

Read more: How many police die every year?

Inner-city violence

"Right now, many communities in America are facing a public safety crisis," President Trump told police in Washington on Wednesday. "Murders in 2015 experienced their largest single-year increase in nearly half a century.

His statement is factually correct (though he has often, wrongly, said that the murder rate was the highest it has been in nearly half a century, and even attacked the press on Tuesday for not reporting this falsehood.)

There was a 10.8% jump in nationwide murder rates from 2014 to 2015, and that represents the biggest year-to-year increase since 1970-71, according to the fact-checking website Politifact.

But it is again important to look at the longer-term trend.

The number of reported murders and rapes across the country did indeed increase from 2014 to 2015, as did robberies.

But all are still below the levels they were at 10 years ago - and are respectively 13%, 6% and 34% lower than 20 years ago (even though the population of the US has increased by 55 million in that time).

The picture is more mixed in large cities, however.

Media playback is unsupported on your device Media caption In September 2016, Donald Trump said some US inner cities were more dangerous than Afghanistan - the BBC's More or Less programme investigated his claim.

Last month, The Economist magazine, having obtained an early look at the 2016 FBI data for violence in 50 US cities, showed that there were four broad trends in play.

Murder rates are stable in 13 of the 50 cities, including Los Angeles and New York, which saw 11 days without a murder in 2015.

In 15 other cities, including Houston and Las Vegas, murder rates are low but increasing. In another nine, including Philadelphia and Detroit, they are high but stable. And in 13, including Indianapolis and Chicago, they are high and rising. (You can read The Economist's analysis here).

Media playback is unsupported on your device Media caption Life and death on the lost streets of Chicago

In Chicago, murders rose sharply last year, with more than 760 last year compared with 473 the year before. Up to then, there had been a steady fall in the number of murders since a peak of the early 70s.

Mr Trump has repeatedly used the city as an example. "In Chicago, more than 4,000 people were shot last year alone and the rate so far this year has been even higher. What is going on in Chicago?" he said on Wednesday.

Last month, he even threatened to send federal agents into the city if the violence did not subside.

But again, worrying though recent increases in violence in some cities may be, it is critical to look at how those increases fit in to a longer-term trend.

Ames Grawert, of the Brennan Center for Justice, co-authored a report into crime rates in US cities, and spoke to the BBC's More or Less programme. "If you look at crime rates in American cities in the past 30 years, even with the recent uptick in murders in some cities, we are very far below where we used to be with murder rates in big cities like New York and Los Angeles."

Read more (from 2015): Why have cities' murder rates increased?

Terrorism

President Trump, when he announced the travel restrictions last month, said it was to "keep radical Islamic terrorists out of the US". The restrictions, now in legal limbo, affected citizens from Iraq, Syria, Iran, Libya, Somalia, Sudan, and Yemen - the measures also blocked Syrian refugees from arriving in the US.

So how big a problem is terrorism in the US? First of all, Mr Trump, like other presidents before him, measures the danger of terrorism to the US according to what could happen, rather than what has happened. His comment "I have learned a lot in the past two weeks" indicated he had specific information on the threat to the US.

And secondly, it all depends on what your definition of what terrorism is (more on that later on).

Read more: Trump says terror attacks 'under-reported': Is that true?

One study, by the libertarian Cato Institute, details 3,432 murders committed on US soil between 1975 and late 2015 that it says can be classified as terrorist attacks. Of those, 88% were committed by foreign-born terrorists who entered the country (the 2,977 deaths in the 11 September attacks make up a large chunk of these fatalities).

But does this mean Americans should be worried about being caught up in a terror attack caused by a foreign-born national? Take a look at the numbers the Cato Institute came up with to provide context:

The report's author, Alex Nowrasteh, concluded the number of Americans killed in a terror attack by someone from one of the seven countries on Mr Trump's list, between 1975 and 2015, was zero.

(He does point out that six Iranians, six Sudanese, two Somalis, two Iraqis, and one Yemeni were convicted of attempting or carrying out terrorist attacks on US soil in that time).

Only three deaths were attributed to refugees in the 40 years spanned by the report - and those were caused by three Cuban terrorists in the 1970s.

For some perspective, here are some other causes of death in the US in 2015 alone:

Causes of death in 2015 (US only) 979 people killed by "accidental suffocation or strangulation in bed" 57 by bees, hornets or wasps

21 by glass

22 by contact with hot water from a tap AFP/Getty Images

Far more dangerous than terrorism to Americans are painkillers.

The leading cause of accidental death in the United States is now overdoses from painkillers - opioid medicines kill 60 people a day, or 22,000 a year, according to the National Safety Council.

But it is impossible to discuss the threat from terrorism without looking at how the US defines terrorism itself - and therein lies the problem. Even the FBI says there is "no single, universally accepted, definition of terrorism". The State Department defines terrorism as "premeditated, politically motivated violence perpetrated against non-combatant targets by subnational groups or clandestine agents".

In that case, there is an argument that shootings should be defined as terrorism: those such as the racially-motivated killing of nine black worshippers in South Carolina by a self-avowed white supremacist, the murder of 26 people including children in Newtown, Connecticut, and the murder of 12 people in a Colorado cinema.

If the number of people killed in shootings in the US were considered terrorism - at least 15,055 people were shot dead last year, according to the Gun Violence Archive - then the likelihood of an American being killed in an act of terrorism would increase substantially.