Is material produced for a course considered property of the department? I was asked last year to set up a completely new course, far from my expertise (say, you work on differential equations but they ask you to teach general relativity). The department did not give me much space/resources to do so but anyway I did it very successfully and on a very short notice (based on student's evaluations etc.)

Does the department have the right to take all the material I developed and give it to a new instructor, say next year?
Do they need my agreement and do I have the right to refuse to do so?
Can I take the entire developed course in, for example, a new institution in case I move away? Or the department can claim that it was part of my paid job so it is theirs?

On an ethical level I find it unfair that I had to put an insane amount of work only for the department to come and claim my work and give it &quot;for free&quot; to a new instructor. But I am not sure if legally I can do anything about that.
For what is worth, I am in an academic institution in the Netherlands. I am assistant professor (UD) and, according to the rules (at least in my institution) my job is not to develop new courses, but only to deliver/maintain existing courses in the curriculum.
This is a question that really depends on local custom and policy.  At my institution, there's a clear policy that I own the copyright to materials that I produce for my teaching unless those materials were produced with extra institutional support (e.g. I'm paid extra to develop the course or the institution provides an instructional designer to help in developing a course.)
I'm aware that at many other institutions in the US, instructional content (course syllabi, lecture slides, assignments, etc.) are considered to be work for hire and owned by the institution.  This is very helpful when a course is frequently taught by contingent faculty.