There was a ceiling fan which I removed. I usually would take a picture of the wiring before removal but the design of the fan made that difficult and only after I got the fan down did I see this mess. I will never rush this stuff again. After removal of the ceiling fan I realized that some of the wires were still hot! I was lucky.
I had turned the light switch off first before checking I had the right breaker -- breakers are labeled but not always correctly or completely -- and I should have double checked. And apparently the only switch in the room doesn't control all the wires in that box. Lesson learned. I shut off the main and put nuts on the exposed ends.
Thank you for any help. I have referred to posts on this site for years and obviously I could do a better job of putting all the good safety advice to use.