Are capital gains in foreign brokerage accounts treated as income or capital gains for US tax purposes?

I sold some stocks in a foreign country, I made some capital gains. Where and how do I need to report it? Will it be treated as ordinary income or capital gains?
If ordinary income, will I have to pay state tax on it as well?